closeAllOrders: Close all open orders

Description Usage Arguments Examples

Description

Closes all orders for a given Oanda account.

Usage

1
closeAllOrders(instrument, acct, auth_id, acct_type = "fxpractice")

Arguments

instrument

A single character string representing the currency to perform function on e.g. "EUR_USD"

acct

The Oanda account number

auth_id

Oanda requires a unique authorization ID for every account

acct_type

Account type e.g. fxpractice, fxtrade, or sandbox)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (instrument, acct, auth_id, acct_type = "fxpractice") 
{
    auth <- c(Authorization = paste("Bearer", auth_id))
    url <- paste0("https://api-", acct_type, ".oanda.com/v1/accounts/", 
        acct, "/positions/", instrument)
    closed <- fromJSON(getURL(url, httpheader = auth, customrequest = "DELETE"))
    return(closed)
  }

DunderChief/roanda documentation built on May 22, 2019, 4:28 p.m.