简体   繁体   中英

Python-binance api Twap order

I have been exploring Algorithm trading with little background in programming.

I have a script that trades on Binance and I noticed the Twap API that was released for futures trading. https://www.binance.com/en/support/faq/093927599fd54fd48857237f6ebec0b0

I am trying to incorporate this into my existing code, but I can't seem to figure this out.

A simple market order will be

client.futures_create_order(
                symbol='BTCUSDT',
                type="MARKET",
                side="BUY",  
                quantity=0.2 
                )

How do I create a TWAP order? I have tried setting "type" to "Twap" and added mandatory parameters but I get APIError(code=-1116): Invalid orderType.

For placing Twap futures order, you may wish to send request to this endpoint:

POST /sapi/v1/algo/futures/newOrderTwap

I think the method you are using is for placing normal order, which is calling the endpoint POST /fapi/v1/order

The document: https://binance-docs.github.io/apidocs/spot/en/#time-weighted-average-price-twap-new-order-trade

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM