nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
2.24k stars 506 forks source link

can't submit order #338

Closed Harry040 closed 3 years ago

Harry040 commented 3 years ago

version:

2021-06-03T08:27:07.240455Z [INF] TESTER-001.TradingNode: nautilus-trader 1.121.0
2021-06-03T08:27:07.240489Z [INF] TESTER-001.TradingNode: python 3.9.4
2021-06-03T08:27:07.240523Z [INF] TESTER-001.TradingNode: numpy 1.20.3
2021-06-03T08:27:07.240552Z [INF] TESTER-001.TradingNode: scipy 1.6.3
2021-06-03T08:27:07.240580Z [INF] TESTER-001.TradingNode: pandas 1.2.4
2021-06-03T08:27:07.240623Z [INF] TESTER-001.TradingNode: redis 3.5.3
2021-06-03T08:27:07.240652Z [INF] TESTER-001.TradingNode: msgpack 1.0.2
2021-06-03T08:27:07.240678Z [INF] TESTER-001.TradingNode: uvloop 0.15.2

this is log:

2021-06-03T08:27:32.010948Z [DBG] TESTER-001.ExecEngine: <--[EVT] OrderSubmitted(account_id=BINANCE-grid_account, client_order_id=O-20210603-082732-001-man-3, event_id=358a16fe-f094-9be1-3b68-e06558206984).
2021-06-03T08:27:32.010954Z [INF] TESTER-001.Man-man: <--[EVT] OrderSubmitted(account_id=BINANCE-grid_account, client_order_id=O-20210603-082732-001-man-3, event_id=358a16fe-f094-9be1-3b68-e06558206984).
2021-06-03T08:27:32.010959Z [DBG] TESTER-001.ExecEngine: <--[EVT] OrderRejected(account_id=BINANCE-grid_account, client_order_id=O-20210603-082732-001-man-3, reason='binance LIMIT_MAKER is not a valid order type in market ETH/USDT', event_id=3803b171-0a6f-d0ac-b539-81e8e816961f).
2021-06-03T08:27:32.010966Z [WRN] TESTER-001.Man-man: <--[EVT] OrderRejected(account_id=BINANCE-grid_account, client_order_id=O-20210603-082732-001-man-3, reason='binance LIMIT_MAKER is not a valid order type in market ETH/USDT', event_id=3803b171-0a6f-d0ac-b539-81e8e816961f).
cjdsellers commented 3 years ago

Hmm I remember seeing this recently, possibly due to the version of CCXT

ccxt                          1.50.74
ccxtpro                       0.7.12
2021-06-03T08:48:31.394165Z [INF] TESTER-001.TradingNode: =================================================================
2021-06-03T08:48:31.394181Z [INF] TESTER-001.TradingNode:  VERSIONING
2021-06-03T08:48:31.394196Z [INF] TESTER-001.TradingNode: =================================================================
2021-06-03T08:48:31.394213Z [INF] TESTER-001.TradingNode: nautilus-trader 1.122.0
2021-06-03T08:48:31.394248Z [INF] TESTER-001.TradingNode: python 3.9.5
2021-06-03T08:48:31.394277Z [INF] TESTER-001.TradingNode: numpy 1.20.3
2021-06-03T08:48:31.394302Z [INF] TESTER-001.TradingNode: scipy 1.6.1
2021-06-03T08:48:31.394330Z [INF] TESTER-001.TradingNode: pandas 1.2.4
2021-06-03T08:48:31.394370Z [INF] TESTER-001.TradingNode: redis 3.5.3
2021-06-03T08:48:31.394395Z [INF] TESTER-001.TradingNode: msgpack 1.0.2
2021-06-03T08:48:31.394414Z [INF] TESTER-001.TradingNode: uvloop 0.15.2
2021-06-03T08:48:32.600730Z [INF] TESTER-001.VolatilityMarketMaker-001: Received <Bar[999]> data for ETH/USDT.BINANCE-1-MINUTE-LAST.
2021-06-03T08:48:59.999756Z [INF] TESTER-001.VolatilityMarketMaker-001: Received Bar(ETH/USDT.BINANCE-1-MINUTE-LAST,2833.87,2834.46,2832.56,2832.57,185.95471,1622710140000000000)
2021-06-03T08:48:59.999907Z [INF] TESTER-001.VolatilityMarketMaker-001: [CMD]--> SubmitOrder(BUY 0.01000 ETH/USDT.BINANCE LIMIT @ 2827.70 GTC, trader_id=TESTER-001, strategy_id=VolatilityMarketMaker-001, instrument_id=ETH/USDT.BINANCE, client_order_id=O-20210603-084859-001-001-1, strategy_id=VolatilityMarketMaker-001, command_id=d1ff044e-02ec-0da8-89ac-7b25740da234).
2021-06-03T08:48:59.999978Z [INF] TESTER-001.VolatilityMarketMaker-001: [CMD]--> SubmitOrder(SELL 0.01000 ETH/USDT.BINANCE LIMIT @ 2837.43 GTC, trader_id=TESTER-001, strategy_id=VolatilityMarketMaker-001, instrument_id=ETH/USDT.BINANCE, client_order_id=O-20210603-084859-001-001-2, strategy_id=VolatilityMarketMaker-001, command_id=32be1398-5dee-9f59-4f01-89305cc0a514).
2021-06-03T08:49:00.001097Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] OrderSubmitted(account_id=BINANCE-001, client_order_id=O-20210603-084859-001-001-1, event_id=7b4a6156-dba9-757a-345d-2ac80abba6e0).
2021-06-03T08:49:00.001230Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] OrderSubmitted(account_id=BINANCE-001, client_order_id=O-20210603-084859-001-001-2, event_id=6b43173b-edf0-b183-64d1-7adf1ddaf310).
2021-06-03T08:49:00.162317Z [INF] TESTER-001.Portfolio: BINANCE initial_margin=0E-8
2021-06-03T08:49:00.162329Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] OrderAccepted(account_id=BINANCE-001, client_order_id=O-20210603-084859-001-001-1, venue_order_id=4447565895, event_id=e3da39e8-b554-5a63-5981-c0adcf1bad33).
2021-06-03T08:49:00.164994Z [INF] TESTER-001.Portfolio: BINANCE initial_margin=0E-8
2021-06-03T08:49:00.165000Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] OrderAccepted(account_id=BINANCE-001, client_order_id=O-20210603-084859-001-001-2, venue_order_id=4447565896, event_id=2a26c67a-4695-4231-04fe-7dac31327253).
2021-06-03T08:49:48.260573Z [INF] TESTER-001.Portfolio: BINANCE initial_margin=0E-8
2021-06-03T08:49:48.260762Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] OrderFilled(account_id=BINANCE-001, client_order_id=O-20210603-084859-001-001-1, venue_order_id=4447565895, position_id=P-20210603-084948-001-001-1, strategy_id=VolatilityMarketMaker-001, instrument_id=ETH/USDT.BINANCE, side=BUY-MAKER, last_qty=0.01000, last_px=2827.70, commission=0.00001000 ETH, event_id=848deeeb-46e8-166c-6e5c-025bed6065ea).
2021-06-03T08:49:48.260861Z [INF] TESTER-001.VolatilityMarketMaker-001: [CMD]--> SubmitOrder(BUY 0.01000 ETH/USDT.BINANCE LIMIT @ 2823.11 GTC, trader_id=TESTER-001, strategy_id=VolatilityMarketMaker-001, instrument_id=ETH/USDT.BINANCE, client_order_id=O-20210603-084948-001-001-3, strategy_id=VolatilityMarketMaker-001, command_id=905b3473-0622-9df5-a562-e1de3d65087c).
2021-06-03T08:49:48.260894Z [INF] TESTER-001.Portfolio: ETH/USDT.BINANCE net_position=0.01000
2021-06-03T08:49:48.260906Z [INF] TESTER-001.Portfolio: BINANCE maint_margin=0E-8
2021-06-03T08:49:48.260927Z [INF] TESTER-001.VolatilityMarketMaker-001: <--[EVT] PositionOpened(LONG 0.01000 ETH/USDT.BINANCE, account_id=BINANCE-001, position_id=P-20210603-084948-001-001-1, strategy_id=VolatilityMarketMaker-001, entry=BUY, avg_px_open=2827.70000, LONG 0.01000 ETH/USDT.BINANCE, event_id=317955c6-2774-c7b4-f670-994c9a7cbcb2).
cjdsellers commented 3 years ago

Seems OK now, you could also try post_only=False, which should send LIMIT to their endpoint instead.

Harry040 commented 3 years ago

Thank you for your awesome reply.

I see That binance not supports LIMIT_MAKER. It's ok when set post_only=False.

cjdsellers commented 3 years ago

Great that you fixed it. Although, I believe LIMIT_MAKER is a supported order type for Binance unless there has been a recent API change.

https://github.com/ccxt/ccxt/issues/6352#issuecomment-572238057

Order types (orderTypes, type):

More information on how the order types definitions can be found here: Types of Orders

    LIMIT
    MARKET
    STOP_LOSS
    STOP_LOSS_LIMIT
    TAKE_PROFIT
    TAKE_PROFIT_LIMIT
    LIMIT_MAKER

https://binance-docs.github.io/apidocs/spot/en/#public-api-definitions

Harry040 commented 3 years ago

Great that you fixed it. Although, I believe LIMIT_MAKER is a supported order type for Binance unless there has been a recent API change.

ccxt/ccxt#6352 (comment)

Order types (orderTypes, type):

More information on how the order types definitions can be found here: Types of Orders

    LIMIT
    MARKET
    STOP_LOSS
    STOP_LOSS_LIMIT
    TAKE_PROFIT
    TAKE_PROFIT_LIMIT
    LIMIT_MAKER

https://binance-docs.github.io/apidocs/spot/en/#public-api-definitions

The USD-M Future api seems only support LIMIT. https://binance-docs.github.io/apidocs/futures/en/#new-order-trade

cjdsellers commented 3 years ago

Ah good point! Thanks for discovering that