Binance.Trade (binance v2.0.1)
Account/Trade
Summary
Functions
Cancel all Open Orders on a Symbol (TRADE)
Cancel Order (TRADE)
Cancel OCO (TRADE)
Account Information (USER_DATA)
Query all OCO (USER_DATA)
All Orders (USER_DATA)
Account Trade List (USER_DATA)
Query Open OCO (USER_DATA)
Current Open Orders (USER_DATA)
Query Order (USER_DATA)
Query OCO (USER_DATA)
Query Current Order Count Usage (TRADE)
New Order (TRADE)
Cancel an Existing Order and Send a New Order (TRADE)
Test New Order (TRADE)
Functions
delete_open_orders(symbol, opts \\ [])
@spec delete_open_orders(any(), recvWindow: any(), timestamp: any()) :: {:ok, any()} | {:error, any()}
Cancel all Open Orders on a Symbol (TRADE)
Cancels all active orders on a symbol. This includes OCO orders.
Weight(IP): 1
Details:
- METHOD: delete
- URL: /api/v3/openOrders
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- recvWindow - The value cannot be greater than 60000
delete_order(symbol, opts \\ [])
@spec delete_order(any(), recvWindow: any(), cancelRestrictions: any(), newClientOrderId: any(), origClientOrderId: any(), orderId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Cancel Order (TRADE)
Cancel an active order.
Either orderId
or origClientOrderId
must be sent.
Weight(IP): 1
Details:
- METHOD: delete
- URL: /api/v3/order
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- orderId - Order id
- origClientOrderId - Order id from client
- newClientOrderId - Used to uniquely identify this cancel. Automatically generated by default
- cancelRestrictions - Supported values:
ONLY_NEW - Cancel will succeed if the order status is NEW.
ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED. For more information please refer to Regarding cancelRestrictions
- recvWindow - The value cannot be greater than 60000
delete_order_list(symbol, opts \\ [])
@spec delete_order_list(any(), recvWindow: any(), newClientOrderId: any(), listClientOrderId: any(), orderListId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Cancel OCO (TRADE)
Cancel an entire Order List
Canceling an individual leg will cancel the entire OCO
Weight(IP): 1
Details:
- METHOD: delete
- URL: /api/v3/orderList
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- orderListId - Order list id
- listClientOrderId - A unique Id for the entire orderList
- newClientOrderId - Used to uniquely identify this cancel. Automatically generated by default
- recvWindow - The value cannot be greater than 60000
get_account(recvWindow, opts \\ [])
Account Information (USER_DATA)
Get current account information.
Weight(IP): 10
Details:
- METHOD: get
- URL: /api/v3/account
Mandatory params:
- recvWindow - The value cannot be greater than 60000
Optional params:
- timestamp - timestamp
get_all_order_list(opts \\ [])
@spec get_all_order_list( recvWindow: any(), limit: any(), endTime: any(), startTime: any(), fromId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Query all OCO (USER_DATA)
Retrieves all OCO based on provided optional parameters
Weight(IP): 10
Details:
- METHOD: get
- URL: /api/v3/allOrderList
Mandatory params:
Optional params:
- timestamp - timestamp
- fromId - Trade id to fetch from. Default gets most recent trades.
- startTime - UTC timestamp in ms
- endTime - UTC timestamp in ms
- limit - Default 500; max 1000.
- recvWindow - The value cannot be greater than 60000
get_all_orders(symbol, opts \\ [])
@spec get_all_orders(any(), recvWindow: any(), limit: any(), endTime: any(), startTime: any(), orderId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
All Orders (USER_DATA)
Get all account orders; active, canceled, or filled..
- If
orderId
is set, it will get orders >= thatorderId
. Otherwise most recent orders are returned. - For some historical orders
cummulativeQuoteQty
will be < 0, meaning the data is not available at this time. - If
startTime
and/orendTime
provided,orderId
is not required
Weight(IP): 10
Details:
- METHOD: get
- URL: /api/v3/allOrders
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- orderId - Order id
- startTime - UTC timestamp in ms
- endTime - UTC timestamp in ms
- limit - Default 500; max 1000.
- recvWindow - The value cannot be greater than 60000
get_my_trades(symbol, opts \\ [])
@spec get_my_trades(any(), recvWindow: any(), limit: any(), fromId: any(), endTime: any(), startTime: any(), orderId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Account Trade List (USER_DATA)
Get trades for a specific account and symbol.
If fromId
is set, it will get id >= that fromId
. Otherwise most recent orders are returned.
Weight(IP): 10
Details:
- METHOD: get
- URL: /api/v3/myTrades
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- orderId - This can only be used in combination with symbol.
- startTime - UTC timestamp in ms
- endTime - UTC timestamp in ms
- fromId - Trade id to fetch from. Default gets most recent trades.
- limit - Default 500; max 1000.
- recvWindow - The value cannot be greater than 60000
get_open_order_list(opts \\ [])
Query Open OCO (USER_DATA)
Weight(IP): 3
Details:
- METHOD: get
- URL: /api/v3/openOrderList
Mandatory params:
Optional params:
- timestamp - timestamp
- recvWindow - The value cannot be greater than 60000
get_open_orders(opts \\ [])
@spec get_open_orders(recvWindow: any(), symbol: any(), timestamp: any()) :: {:ok, any()} | {:error, any()}
Current Open Orders (USER_DATA)
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight(IP):
3
for a single symbol;40
when the symbol parameter is omitted;
Details:
- METHOD: get
- URL: /api/v3/openOrders
Mandatory params:
Optional params:
- timestamp - timestamp
- symbol - Trading symbol, e.g. BNBUSDT
- recvWindow - The value cannot be greater than 60000
get_order(symbol, opts \\ [])
@spec get_order(any(), recvWindow: any(), origClientOrderId: any(), orderId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Query Order (USER_DATA)
Check an order's status.
- Either
orderId
ororigClientOrderId
must be sent. - For some historical orders
cummulativeQuoteQty
will be < 0, meaning the data is not available at this time.
Weight(IP): 2
Details:
- METHOD: get
- URL: /api/v3/order
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- timestamp - timestamp
- orderId - Order id
- origClientOrderId - Order id from client
- recvWindow - The value cannot be greater than 60000
get_order_list(opts \\ [])
@spec get_order_list( recvWindow: any(), origClientOrderId: any(), orderListId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Query OCO (USER_DATA)
Retrieves a specific OCO based on provided optional parameters
Weight(IP): 2
Details:
- METHOD: get
- URL: /api/v3/orderList
Mandatory params:
Optional params:
- timestamp - timestamp
- orderListId - Order list id
- origClientOrderId - Order id from client
- recvWindow - The value cannot be greater than 60000
get_rate_limit_order(opts \\ [])
Query Current Order Count Usage (TRADE)
Displays the user's current order count usage for all intervals.
Weight(IP): 20
Details:
- METHOD: get
- URL: /api/v3/rateLimit/order
Mandatory params:
Optional params:
- timestamp - timestamp
- recvWindow - The value cannot be greater than 60000
post_order(symbol, side, type, opts \\ [])
@spec post_order(any(), any(), any(), recvWindow: any(), selfTradePreventionMode: any(), newOrderRespType: any(), icebergQty: any(), trailingDelta: any(), stopPrice: any(), strategyType: any(), strategyId: any(), newClientOrderId: any(), price: any(), quoteOrderQty: any(), quantity: any(), timeInForce: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
New Order (TRADE)
Send in a new order.
LIMIT_MAKER
areLIMIT
orders that will be rejected if they would immediately match and trade as a taker.STOP_LOSS
andTAKE_PROFIT
will execute aMARKET
order when thestopPrice
is reached.- Any
LIMIT
orLIMIT_MAKER
type order can be made an iceberg order by sending anicebergQty
. - Any order with an
icebergQty
MUST havetimeInForce
set toGTC
. MARKET
orders usingquantity
specifies how much a user wants to buy or sell based on the market price.MARKET
orders usingquoteOrderQty
specifies the amount the user wants to spend (when buying) or receive (when selling) of the quote asset; the correct quantity will be determined based on the market liquidity andquoteOrderQty
.MARKET
orders usingquoteOrderQty
will not breakLOT_SIZE
filter rules; the order will execute a quantity that will have the notional value as close as possible toquoteOrderQty
.- same
newClientOrderId
can be accepted only when the previous one is filled, otherwise the order will be rejected.
Trigger order price rules against market price for both MARKET
and LIMIT
versions:
- Price above market price:
STOP_LOSS
BUY
,TAKE_PROFIT
SELL
- Price below market price:
STOP_LOSS
SELL
,TAKE_PROFIT
BUY
Weight(IP): 1
Details:
- METHOD: post
- URL: /api/v3/order
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
- side -
- type - Order type
Optional params:
- timestamp - timestamp
- timeInForce - Order time in force
- quantity - Order quantity
- quoteOrderQty - Quote quantity
- price - Order price
- newClientOrderId - A unique id among open orders. Automatically generated if not sent.
- strategyId -
- strategyType - The value cannot be less than 1000000
- stopPrice - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- trailingDelta - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- icebergQty - Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
- newOrderRespType - Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.
- selfTradePreventionMode - The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
- recvWindow - The value cannot be greater than 60000
post_order_cancel_replace(symbol, side, type, cancelReplaceMode, opts \\ [])
@spec post_order_cancel_replace(any(), any(), any(), any(), recvWindow: any(), cancelRestrictions: any(), selfTradePreventionMode: any(), newOrderRespType: any(), icebergQty: any(), trailingDelta: any(), stopPrice: any(), strategyType: any(), strategyId: any(), newClientOrderId: any(), cancelOrderId: any(), cancelOrigClientOrderId: any(), cancelNewClientOrderId: any(), price: any(), quoteOrderQty: any(), quantity: any(), timeInForce: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Cancel an Existing Order and Send a New Order (TRADE)
Cancels an existing order and places a new order on the same symbol.
Filters are evaluated before the cancel order is placed.
If the new order placement is successfully sent to the engine, the order count will increase by 1.
Weight(IP): 1
Details:
- METHOD: post
- URL: /api/v3/order/cancelReplace
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
- side -
- type - Order type
- cancelReplaceMode - -
STOP_ON_FAILURE
If the cancel request fails, the new order placement will not be attempted. ALLOW_FAILURES
If new order placement will be attempted even if cancel request fails.
Optional params:
- timestamp - timestamp
- timeInForce - Order time in force
- quantity - Order quantity
- quoteOrderQty - Quote quantity
- price - Order price
- cancelNewClientOrderId - Used to uniquely identify this cancel. Automatically generated by default
- cancelOrigClientOrderId - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
- cancelOrderId - Either the cancelOrigClientOrderId or cancelOrderId must be provided. If both are provided, cancelOrderId takes precedence.
- newClientOrderId - Used to identify the new order. Automatically generated by default
- strategyId -
- strategyType - The value cannot be less than 1000000
- stopPrice - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- trailingDelta - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- icebergQty - Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
- newOrderRespType - Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.
- selfTradePreventionMode - The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
- cancelRestrictions - Supported values:
ONLY_NEW - Cancel will succeed if the order status is NEW.
ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED. For more information please refer to Regarding cancelRestrictions
- recvWindow - The value cannot be greater than 60000
post_order_oco(symbol, side, quantity, price, stopPrice, opts \\ [])
@spec post_order_oco(any(), any(), any(), any(), any(), recvWindow: any(), selfTradePreventionMode: any(), newOrderRespType: any(), stopLimitTimeInForce: any(), stopIcebergQty: any(), stopLimitPrice: any(), stopStrategyType: any(), stopStrategyId: any(), stopClientOrderId: any(), trailingDelta: any(), limitIcebergQty: any(), limitStrategyType: any(), limitStrategyId: any(), limitClientOrderId: any(), listClientOrderId: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
New OCO (TRADE)
Send in a new OCO
- Price Restrictions:
SELL
: Limit Price > Last Price > Stop PriceBUY
: Limit Price < Last Price < Stop Price
- Quantity Restrictions:
- Both legs must have the same quantity
ICEBERG
quantities however do not have to be the same
- Order Rate Limit
OCO
counts as 2 orders against the order rate limit.
Weight(IP): 1
Details:
- METHOD: post
- URL: /api/v3/order/oco
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
- side -
- quantity -
- price - Order price
- stopPrice -
Optional params:
- timestamp - timestamp
- listClientOrderId - A unique Id for the entire orderList
- limitClientOrderId - A unique Id for the limit order
- limitStrategyId -
- limitStrategyType - The value cannot be less than 1000000
- limitIcebergQty -
- trailingDelta -
- stopClientOrderId - A unique Id for the stop loss/stop loss limit leg
- stopStrategyId -
- stopStrategyType - The value cannot be less than 1000000
- stopLimitPrice - If provided, stopLimitTimeInForce is required.
- stopIcebergQty -
- stopLimitTimeInForce -
- newOrderRespType - Set the response JSON.
- selfTradePreventionMode - The allowed enums is dependent on what is configured on the symbol. The possible supported values are EXPIRE_TAKER, EXPIRE_MAKER, EXPIRE_BOTH, NONE
- recvWindow - The value cannot be greater than 60000
post_order_test(symbol, side, type, opts \\ [])
@spec post_order_test(any(), any(), any(), recvWindow: any(), newOrderRespType: any(), icebergQty: any(), trailingDelta: any(), stopPrice: any(), strategyType: any(), strategyId: any(), newClientOrderId: any(), price: any(), quoteOrderQty: any(), quantity: any(), timeInForce: any(), timestamp: any() ) :: {:ok, any()} | {:error, any()}
Test New Order (TRADE)
Test new order creation and signature/recvWindow long. Creates and validates a new order but does not send it into the matching engine.
Weight(IP): 1
Details:
- METHOD: post
- URL: /api/v3/order/test
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
- side -
- type - Order type
Optional params:
- timestamp - timestamp
- timeInForce - Order time in force
- quantity - Order quantity
- quoteOrderQty - Quote quantity
- price - Order price
- newClientOrderId - A unique id among open orders. Automatically generated if not sent.
- strategyId -
- strategyType - The value cannot be less than 1000000
- stopPrice - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- trailingDelta - Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
- icebergQty - Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
- newOrderRespType - Set the response JSON. MARKET and LIMIT order types default to FULL, all other orders default to ACK.
- recvWindow - The value cannot be greater than 60000