tn_place_order {bitmexr}R Documentation

Place an order (testnet)

Description

Place an order using the Bitmex testnet API. Requires testnet API key.

Usage

tn_place_order(
  symbol = NULL,
  side = NULL,
  orderQty = NULL,
  price = NULL,
  displayQty = NULL,
  stopPx = NULL,
  clOrdID = NULL,
  pegOffsetValue = NULL,
  pegPriceType = NULL,
  ordType = NULL,
  timeInForce = NULL,
  execInst = NULL,
  text = NULL
)

Arguments

symbol

string. Instrument symbol. e.g. 'XBTUSD'.

side

string. Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless orderQtyis negative.

orderQty

double. Order quantity in units of the instrument (i.e. contracts).

price

double. Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.

displayQty

double. Optional quantity to display in the book. Use 0 for a fully hidden order.

stopPx

double. Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. Use execInst of 'MarkPrice' or 'LastPrice' to define the current price used for triggering.

clOrdID

string. Optional Client Order ID. This clOrdID will come back on the order and any related executions.

pegOffsetValue

string. Optional trailing offset from the current price for 'Stop', 'StopLimit', ' MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.

pegPriceType

string. Optional peg price type. Valid options: LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.

ordType

string. Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, Pegged. Defaults to 'Limit' when price is specified. Defaults to 'Stop' when stopPx is specified. Defaults to 'StopLimit' when price and stopPx are specified.

timeInForce

string. Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.

execInst

string. Optional execution instructions. Valid options: ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed. 'AllOrNone' instruction requires displayQty to be 0. 'MarkPrice', 'IndexPrice' or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders.

text

string. Optional order annotation. e.g. 'Take profit'.

Value

Returns a tibble containing information about the trade that has been placed. See https://testnet.bitmex.com/api/explorer/#!/Order/Order_new for more details.

Examples

## Not run: 
# place limit order to Buy at specific price
tn_place_order(symbol = "XBTUSD", price = 6000, orderQty = 10)

## End(Not run)


[Package bitmexr version 0.3.3 Index]