Place an order using the Bitmex API. Requires API key.
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
)
A tibble containing information about the trade that has been placed. See https://www.bitmex.com/api/explorer/#!/Order/Order_new for more details.
string. Instrument symbol. e.g. 'XBTUSD'.
string. Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless orderQty
is negative.
double. Order quantity in units of the instrument (i.e. contracts).
double. Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
double. Optional quantity to display in the book. Use 0 for a fully hidden order.
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.
string. Optional Client Order ID. This clOrdID will come back on the order and any related executions.
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.
string. Optional peg price type. Valid options: LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.
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.
string. Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
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.
string. Optional order annotation. e.g. 'Take profit'.
if (FALSE) {
# place limit order to Buy 10 contracts at a specific price
place_order(symbol = "XBTUSD", price = 6000, orderQty = 10)
}
Run the code above in your browser using DataLab