createOandaOrder: Create an Order for an Oanda Account

Description Usage Arguments Value Examples

View source: R/OandaOrders.R

Description

Create an Order for an Oanda Account

Usage

1
2
3
4
5
createOandaOrder(ACCOUNT_TYPE, ACCESS_TOKEN, ACCOUNT_ID,
  INSTRUMENTS = "AUD_USD", UNITS, POSITIONFILL = "DEFAULT",
  STOPLOSS = NULL, TAKEPROFIT = NULL, TRAILINGSTOP = NULL,
  ORDERTYPE = "MARKET", TIMEINFORCE = "FOK", GTDTIME = NULL,
  PRICE = NULL, ...)

Arguments

ACCOUNT_TYPE

"practice", "real" or "sandbox"

ACCESS_TOKEN

The authorization bearer token previously obtained by the client, can be found in oanda environment

ACCOUNT_ID

ID of the Account to create the Order for.

INSTRUMENTS

Instrument to get candlestick data for e.g. "AUD_USD"

UNITS

Number of units of the instrument to be executed for the order

POSITIONFILL

"MARKET_IF_TOUCHED", "MARKET", "LIMIT" or "DEFAULT"

STOPLOSS

prices of stop loss

TAKEPROFIT

prices of take profits

TRAILINGSTOP

Trailing stop

ORDERTYPE

order types including 'MARKET', 'LIMIT', 'STOP'

TIMEINFORCE

GTC: The Order is “Good unTil Cancelled” | GTD: The Order is “Good unTil Date” and will be cancelled at the provided time | FOK: The Order must be immediately “Filled Or Killed” | IOC: The Order must be “Immediatedly paritally filled Or Cancelled” | GFD: The Order is “Good For Day” and will be cancelled at 5pm New York time

GTDTIME

The date/time when the Limit Order will be cancelled if its timeInForce (e.g. 2014-07-02T04:00:00.000000Z)

PRICE

for limit order which only will be filled when the prices are better

Value

A HTTP Response

Examples

1
2
3
4
5
6
7
createOandaOrder(.oandaEnv$ACCOUNT_TYPE, .oandaEnv$ACCESS_TOKEN, .oandaEnv$ACCOUNT_ID, INSTRUMENTS = 'AUD_USD', UNITS = -10000)
# HTTP 201 – The Order was created as specified
# Response [https://api-fxpractice.oanda.com/v3/accounts/101-011-4686012-003/orders]
# Date: 2016-11-28 11:38
# Status: 201
# Content-Type: application/json
# Size: 775 B

ivanliu1989/RQuantAPI documentation built on Sept. 13, 2019, 11:54 a.m.