-
Notifications
You must be signed in to change notification settings - Fork 1
Spot Account_Trade
Spot Account/Trade endpoints are under bnc spot
group command.
Jump to:
- New order
- Cancel order
- Cancel all open orders on a symbol
- Query Order (Order status)
- Current Open Orders
- All Orders
- New OCO Order
- Cancel OCO Order
- Query OCO Order
- Query all OCO Order
- Query open OCO Orders
- Account Information
- Account Trade List
https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
Different types of orders are under bnc spot new_order
group command.
Jump to:
At this date [April 2021], Binance doesn't support STOP_LOSS
or TAKE_PROFIT
orders for any of the symbols.
Instead, you have to use STOP_LOSS_LIMIT
or TAKE_PROFIT_LIMIT
orders.
If you discovered a symbol allowed to create a STOP_LOSS or TAKE_PROFIT orders, you could fill an issue to inform this.
Send in a new limit order
bnc spot new_order limit
-
-sy
or--symbol
-
-si
or--side
-
-tif
or--time_in_force
-
-q
or--quantity
-
-p
or--price
-
-ncoid
or--new_client_order_id
-
-iq
or--iceberg_qty
-
-rw
or--recv_window
-
-nort
or--new_order_resp_type
-sy --symbol
-si --side
-tif --time_in_force
-q --quantity
-p --price
$ bnc spot new_order limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0033
$ bnc spot new_order limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0036 --new_client_order_id="custom_id"
$ bnc spot new_order limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0036 --iceberg_qty=0.20
$ bnc spot new_order limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0036 --new_order_resp_type="ACK"
$ bnc spot new_order limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0033
$ bnc spot new_order limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0033 -ncoid "custom_id"
$ bnc spot new_order limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0033 -iq 0.20
$ bnc spot new_order limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0033 -nort "ACK"
Send in a new limit maker order
bnc spot new_order limit_maker
-
-sy
or--symbol
-
-si
or--side
-
-q
or--quantity
-
-p
or--price
-
-ncoid
or--new_client_order_id
-
-iq
or--iceberg_qty
-
-rw
or--recv_window
-
-nort
or--new_order_resp_type
-sy --symbol
-si --side
-q --quantity
-p --price
$ bnc spot new_order limit_maker --symbol="LTCBTC" --side="BUY" --quantity=1 --price=0.0020
$ bnc spot new_order limit_maker --symbol="LTCBTC" --side="BUY" --quantity=1 --price=0.0020 --new_client_order_id="my_custom_id"
$ bnc spot new_order limit_maker --symbol="LTCBTC" --side="BUY" --quantity=1 --price=0.0020 --iceberg_qty=0.5
$ bnc spot new_order limit_maker --symbol="LTCBTC" --side="BUY" --quantity=1 --price=0.0020 --new_order_resp_type="FULL"
$ bnc spot new_order limit_maker -sy "LTCBTC" -si "BUY" -q 1 -p 0.0020
$ bnc spot new_order limit_maker -sy "LTCBTC" -si "BUY" -q 1 -p 0.0020 -ncoid "my_custom_id"
$ bnc spot new_order limit_maker -sy "LTCBTC" -si "BUY" -q 1 -p 0.0020 -iq 0.5
$ bnc spot new_order limit_maker -sy "LTCBTC" -si "BUY" -q 1 -p 0.0020 -nort "FULL"
Send in a new market order
Note:
Either --quantity (-q) or --quote_order_qty (-qoq) must be sent.
bnc spot new_order market
-
-sy
or--symbol
-
-si
or--side
-
-q
or--quantity
-
-qoq
or--quote_order_qty
-
-ncoid
or--new_client_order_id
-
-rw
or--recv_window
-
-nort
or--new_order_resp_type
-sy --symbol
-si --side
$ bnc spot new_order market --symbol="LTCBTC" --side="BUY" --quantity=1
$ bnc spot new_order market --symbol="LTCBTC" --side="BUY" --quote_order_qty=1
$ bnc spot new_order market --symbol="LTCBTC" --side="BUY" --quantity=1 --new_client_order_id="custom_id"
$ bnc spot new_order market --symbol="LTCBTC" --side="BUY" --quantity=1 --new_order_resp_type="RESULT"
$ bnc spot new_order market -sy "LTCBTC" -si "BUY" -q 1
$ bnc spot new_order market -sy "LTCBTC" -si "BUY" -qoq 1
$ bnc spot new_order market -sy "LTCBTC" -si "BUY" -q 1 -ncoid "custom_id"
$ bnc spot new_order market -sy "LTCBTC" -si "BUY" -q 1 -nort "RESULT"
Send in a new take profit limit order
bnc spot new_order take_profit_limit
-
-sy
or--symbol
-
-si
or--side
-
-tif
or--time_in_force
-
-q
or--quantity
-
-p
or--price
-
-ncoid
or--new_client_order_id
-
-sp
or--stop_price
-
-iq
or--iceberg_qty
-
-rw
or--recv_window
-
-nort
or--new_order_resp_type
-sy --symbol
-si --side
-tif --time_in_force
-q --quantity
-p --price
-sp --stop_price
$ bnc spot new_order take_profit_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0020 --stop_price=0.0015
$ bnc spot new_order take_profit_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0020 --stop_price=0.0015 --new_client_order_id="custom_id"
$ bnc spot new_order take_profit_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0020 --stop_price=0.0015 --iceberg_qty=0.5
$ bnc spot new_order take_profit_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0020 --stop_price=0.0015 --new_order_resp_type="FULL"
$ bnc spot new_order take_profit_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0020 -sp 0.0015
$ bnc spot new_order take_profit_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0020 -sp 0.0015 -ncoid "custom_id"
$ bnc spot new_order take_profit_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0020 -sp 0.0015 -iceberg_qty 0.5
$ bnc spot new_order take_profit_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0020 -sp 0.0015 -nort "FULL"
Send in a new stop loss limit order
bnc spot new_order stoo_loss_limit
-
-sy
or--symbol
-
-si
or--side
-
-tif
or--time_in_force
-
-q
or--quantity
-
-p
or--price
-
-ncoid
or--new_client_order_id
-
-sp
or--stop_price
-
-iq
or--iceberg_qty
-
-rw
or--recv_window
-
-nort
or--new_order_resp_type
-sy --symbol
-si --side
-tif --time_in_force
-q --quantity
-p --price
-sp --stop_price
$ bnc spot new_order stop_loss_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0060 --stop_price=0.0050
$ bnc spot new_order stop_loss_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0060 --stop_price=0.0050 --new_client_order_id="custom_id"
$ bnc spot new_order stop_loss_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0060 --stop_price=0.0050 --iceberg_qty=0.5--iceberg_qty=0.5
$ bnc spot new_order stop_loss_limit --symbol="LTCBTC" --side="BUY" --time_in_force="GTC" --quantity=1 --price=0.0060 --stop_price=0.0050 --new_order_resp_type="FULL"
$ bnc spot new_order stop_loss_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0060 -sp 0.0050
$ bnc spot new_order stop_loss_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0060 -sp 0.0050 -ncoid "custom_id"
$ bnc spot new_order stop_loss_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0060 -sp 0.0050 -iceberg_qty 0.5
$ bnc spot new_order stop_loss_limit -sy "LTCBTC" -si "BUY" -tif "GTC" -q 1 -p 0.0060 -sp 0.0050 -nort "FULL"
https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
Cancel an active order.
Weight:
- 1
bnc spot cancel_order [options]
-
-sy
or--symbol
-
-oid
or--order_id
-
-ocoid
or--orig_client_order_id
-
-ncoid
or--new_client_order_id
-
-rw
or--recv_window
-sy --symbol
$ bnc spot cancel_order --symbol="LTCBTC" --order_id=136
$ bnc spot cancel_order --symbol="LTCBTC" --orig_client_order_id="FNgPVZtPCUP9Uw0zMBGofl"
$ bnc spot cancel_order --symbol="LTCBTC" --order_id=138 --orig_client_order_id="R0h99zavwIbthu5Tb7QVOh"
$ bnc spot cancel_order --symbol="LTCBTC" --order_id=141 --orig_client_order_id="9d8SDJbefO9D593XuGa3SZ" --new_client_order_id="my_custom_id"
$ bnc spot cancel_order -sy "LTCBTC" -oid 6
$ bnc spot cancel_order -sy "LTCBTC" -ocoid "FNgPVZtPCUP9Uw0zMBGofl"
$ bnc spot cancel_order -sy "LTCBTC" -oid 138 -ocoid "R0h99zavwIbthu5Tb7QVOh"
$ bnc spot cancel_order -sy "LTCBTC" -oid 141 -ocoid "9d8SDJbefO9D593XuGa3SZ" -ncoid "my_custom_id"
https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
Cancels all active orders on a symbol. This includes OCO orders.
Weight:
- 1
bnc spot cancel_all_orders [options]
-
-sy
or--symbol
-
-rw
or--recv_window
-sy --symbol
$ bnc spot cancel_all_orders --symbol="LTCBTC"
$ bnc spot cancel_all_orders -sy "LTCBTC"
https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
Check an order's status.
Weight:
- 1
bnc spot order_status [options]
-
-sy
or--symbol
-
-oid
or--order_id
-
-ocoid
or--orig_client_order_id
-
-rw
or--recv_window
-sy --symbol
$ bnc spot order_status --symbol="LTCBTC" --order_id=6
$ bnc spot order_status --symbol="LTCBTC" --orig_client_order_id="OryHfXeB5m6T1sVe5cC289"
$ bnc spot order_status --symbol="LTCBTC" --order_id=6 --orig_client_order_id="OryHfXeB5m6T1sVe5cC289"
$ bnc spot order_status -sy "LTCBTC" -oid 6
$ bnc spot order_status -sy "LTCBTC" -ocoid "OryHfXeB5m6T1sVe5cC289"
$ bnc spot order_status -sy "LTCBTC" -oid 6 -ocoid "OryHfXeB5m6T1sVe5cC289"
https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight:
- 1 for a single symbol.
- 40 when the symbol parameter is omitted.
bnc spot open_orders [options]
-
-sy
or--symbol
-
-rw
or--recv_window
$ bnc spot open_orders
$ bnc spot open_orders --symbol="LTCBTC"
$ bnc spot open_orders -sy "LTCBTC"
Get all account orders; active, canceled, or filled.
Weight:
- 5 with symbol.
Notes:
If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
bnc spot all_orders [options]
-
-sy
or--symbol
-
-oid
or--order_id
-
-st
or--start_time
-
-et
or--end_time
-
-l
or--limit
-
-rw
or--recv_window
--query
-sy --symbol
$ bnc spot all_orders --symbol="LTCBTC"
$ bnc spot all_orders --symbol="LTCBTC" --order_id=497
$ bnc spot all_orders --symbol="LTCBTC" --start_time=1617896183262
$ bnc spot all_orders --symbol="LTCBTC" --start_time=1617896183262 --end_time=1617896193262
$ bnc spot all_orders --symbol="LTCBTC" --limit=1
$ bnc spot all_orders -sy "LTCBTC"
$ bnc spot all_orders -sy "LTCBTC" -oid 497
$ bnc spot all_orders -sy "LTCBTC" -st 1617896183262
$ bnc spot all_orders -sy "LTCBTC" -st 1617896183262 -et 1617896193262
$ bnc spot all_orders -sy "LTCBTC" -l 1
$ bnc spot all_orders --symbol="LTCBTC" --query="[?type=='TAKE_PROFIT_LIMIT']"
$ bnc spot all_orders --symbol="LTCBTC" --query="[?status!='CANCELED' && status != 'EXPIRED']"
$ bnc spot all_orders --symbol="LTCBTC" --query="[?status!='CANCELED' && status != 'EXPIRED']" --limit=2
Send in a new OCO order
Weight:
- 1
Other Info:
- Price Restrictions:
- SELL: Limit Price > Last Price > Stop Price
- BUY: 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.
bnc spot new_oco_order [options]
-
-sy
or--symbol
-
-lcoid
or--list_client_order_id
-
-si
or--side
-
-q
or--quantity
-
-limcoid
or--limit_client_order_id
-
-p
or--price
-
-liq
or--limit_iceberg_qty
-
-scoid
or--stop_client_order_id
-
-sp
or--stop_price
-
-slp
or--stop_limit_price
-
-siq
or--stop_iceberg_qty
-
-sltif
or--stop_limit_time_in_force
-
-nort
or--new_order_resp_type
-
-rw
or--recv_window
-sy --symbol
-si --side
-q --quantity
-p --price
-sp --stop_price
At this date [April 2021], Binance doesn't support STOP_LOSS
orders for any of the symbols, so if you only use all required options
for this command, you are going to receive the following message:
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.0036 --stop_price=0.0020
> Stop loss orders are not supported for this symbol.
The solution is to create a STOP_LOSS_LIMIT
order using optional options.
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.015 --stop_price=0.008 --stop_limit_price=0.0075 --stop_limit_time_in_force="GTC"
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.015 --stop_price=0.008 \
--stop_limit_price=0.0075 --stop_limit_time_in_force="GTC" \
--list_client_order_id="custom1_list_client_order_id" \
--limit_client_order_id="custom_limit_client_order_id" \
--stop_client_order_id="custom_stop_client_order_id"
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.015 --stop_price=0.008 --stop_limit_price=0.0075 --stop_limit_time_in_force="GTC" --limit_iceberg_qty=0.5
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.015 --stop_price=0.008 --stop_limit_price=0.0075 --stop_limit_time_in_force="GTC" --stop_iceberg_qty=0.5
$ bnc spot new_oco_order --symbol="LTCBTC" --side="SELL" --quantity=1 --price=0.015 --stop_price=0.008 --stop_limit_price=0.0075 --stop_limit_time_in_force="GTC" --new_order_resp_type="ACK"
$ bnc spot new_oco_order -sy "LTCBTC" -si "SELL" -q 1 -p 0.015 -sp 0.008 -slp 0.0075 -sltif "GTC"
$ bnc spot new_oco_order -sy "LTCBTC" -si "SELL" -q 1 -p 0.015 -sp 0.008 -slp 0.0075 -sltif "GTC" \
-lcoid "custom1_list_client_order_id" \
-limcoid "custom_limit_client_order_id" \
-scoid "custom_stop_client_order_id"
$ bnc spot new_oco_order -sy "LTCBTC" -si "SELL" -q 1 -p 0.015 -sp 0.008 -slp 0.0075 -sltif "GTC" -liq 0.5
$ bnc spot new_oco_order -sy "LTCBTC" -si "SELL" -q 1 -p 0.015 -sp 0.008 -slp 0.0075 -sltif "GTC" -siq 0.5
$ bnc spot new_oco_order -sy "LTCBTC" -si "SELL" -q 1 -p 0.015 -sp 0.008 -slp 0.0075 -sltif "GTC" -nort "ACK"
Cancel an entire Order List.
Weight:
- 1
Additional notes:
- Canceling an individual leg will cancel the entire OCO
bnc spot cancel_oco_order [options]
-
-sy
or--symbol
-
-olid
or--order_list_id
-
-lcoid
or--list_client_order_id
-
-ncoid
or--new_client_order_id
-
-rw
or--recv_window
-sy --symbol
-olid --order_list_id or -lcoid --list_client_order_id
$ bnc spot cancel_oco_order --symbol="LTCBTC" --order_list_id=578
$ bnc spot cancel_oco_order --symbol="LTCBTC" --list_client_order_id="QEOBf6o3NyCf2w6jfj1mrP"
$ bnc spot cancel_oco_order --symbol="LTCBTC" --order_list_id=578 --new_client_order_id="tKTpu9lI1BjNq8vmnNjtsM"
$ bnc spot cancel_oco_order -sy "LTCBTC" -olid 578
$ bnc spot cancel_oco_order -sy "LTCBTC" -lcoid "QEOBf6o3NyCf2w6jfj1mrP"
$ bnc spot cancel_oco_order -sy "LTCBTC" -olid 578 -ncoid "tKTpu9lI1BjNq8vmnNjtsM"
Retrieves a specific OCO based on provided optional parameters
Weight:
- 1
bnc spot oco_order [options]
-
-olid
or--order_list_id
-
-lcoid
or--list_client_order_id
-
-rw
or--recv_window
-olid --order_list_id or -lcoid --list_client_order_id
$ bnc spot oco_order --order_list_id=592
$ bnc spot oco_order --list_client_order_id="ykprg1hXtgmNjHVcZ3YKNM"
$ bnc spot oco_order --order_list_id=592 --list_client_order_id="ykprg1hXtgmNjHVcZ3YKNM"
$ bnc spot oco_order -olid 592
$ bnc spot oco_order -lcoid "ykprg1hXtgmNjHVcZ3YKNM"
$ bnc spot oco_order -olid 592 -lcoid "ykprg1hXtgmNjHVcZ3YKNM"
Retrieves all OCO based on provided optional parameters
Weight:
- 10
bnc spot all_oco_orders [options]
-
-fid
or--from_id
-
-st
or--start_time
-
-et
or--end_time
-
-l
or--limit
-
-rw
or--recv_window
$ bnc spot all_oco_orders
$ bnc spot all_oco_orders --from_id=590
$ bnc spot all_oco_orders --start_time=1618359398560 --end_time=1618359398567
$ bnc spot all_oco_orders --limit=2
$ bnc spot all_oco_orders -fid 590
$ bnc spot all_oco_orders -st 1618359398560 -et 1618359398567
$ bnc spot all_oco_orders -l 2
Weight:
- 2
bnc spot open_oco_orders [options]
-
-rw
or--recv_window
$ bnc spot open_oco_orders
https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data
Get current account information.
Weight:
- 5
bnc spot account_info [options]
-
-q
or--query
$ bnc spot account_info
$ bnc spot account_info --query='balances[?to_number(free)>`0`] | { balances: @ }'
$ bnc spot account_info --query='balances[?to_number(locked)>`0`] | { balances: @ }'
Get trades for a specific account and symbol.
Weight:
- 5
Notes:
If fromId is set, it will get id >= that fromId. Otherwise most recent trades are returned.
bnc spot my_trades [options]
-
-sy
or--symbol
-
-st
or--start_time
-
-et
or--end_time
-
-fid
or--from_id
-
-l
or--limit
-
-rw
or--recv_window
--query
-sy --symbol
$ bnc spot my_trades --symbol="LTCBTC"
$ bnc spot my_trades --symbol="LTCBTC" --start_time=1617896183262
$ bnc spot my_trades --symbol="LTCBTC" --start_time=1617896183262 --end_time=1617896193262
$ bnc spot my_trades --symbol="LTCBTC" --from_id=497
$ bnc spot my_trades --symbol="LTCBTC" --limit=1
$ bnc spot my_trades -sy "LTCBTC"
$ bnc spot my_trades -sy "LTCBTC" -st 1617896183262
$ bnc spot my_trades -sy "LTCBTC" -st 1617896183262 -et 1617896193262
$ bnc spot my_trades -sy "LTCBTC" -fid 497
$ bnc spot my_trades -sy "LTCBTC" -l 1
$ bnc spot my_trades --symbol="LTCBTC" --query='[?to_number(price)<=`0.0030`]'
If this package helped you out. Feel free to donate.
This project is linked to a Brave verified creator account, so you can set a monthly contribution (with BAT token) to this project using your Brave browser.
- BNB (BEP20): 0xDD460d5d6688beC66E37A6b7c8f5b3f801603537
- CAKE (BEP20): 0xDD460d5d6688beC66E37A6b7c8f5b3f801603537
- BUSD (BEP20): 0xDD460d5d6688beC66E37A6b7c8f5b3f801603537
- ETH (ERC20): 0xDD460d5d6688beC66E37A6b7c8f5b3f801603537
- BTC: 15yLrtPkRbxd5sEBWHGUCzYXraVA78RFz5
Not your favorite crypto address listed?
Fill an issue, and we will add the crypto address.