StevenWhite
StevenWhite

Reputation: 6034

Stop Limit Order in python-binance API

I'd like to place a Stop Limit Order as described on their site. In other words, I want to place a limit order to buy once a certain stop price is reached.

The API documentation only has one example of the client.create_order function which is a basic limit order. The Binance documentation also doesn't give examples of this type of order.

I'm having trouble figuring out which settings to use for the client.create_order function through the API. Should the order type be STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT? What is the difference between these? In other words, can they both be used to Buy in different ways or do they each require a specific side?

EDIT: I found some more clarification here. This explains that a stop-limit buy order triggers a "Take Profit" order once the target price is met. However, it doesn't specify if this is a Market or Limit order. If it's a limit order, the example doesn't make much sense because they offered way more money than the stop price. If it's a market order, there should be no need to specify a price at all. What am I missing?

Upvotes: 3

Views: 24629

Answers (2)

Marcel
Marcel

Reputation: 3268

order = client.create_order(
    symbol = symbol, 
    side = SIDE_BUY, 
    type = ORDER_TYPE_STOP_LOSS_LIMIT, 
    timeInForce = TIME_IN_FORCE_GTC, 
    quantity = quantity, 
    price = price, 
    stopPrice = stopPrice)

Reference:

https://binance-docs.github.io/apidocs/spot/en/#new-order-trade

https://github.com/sammchardy/python-binance/blob/master/binance/client.py

Upvotes: 1

CryPtoSmartGuy420
CryPtoSmartGuy420

Reputation: 81

After facing this problem myself, I concluded that these types of orders are not possible for Spot trading. I may be wrong so quote me on that. To solve it myself I switched to Futures trading and it works without trouble :

link to my own similar question and brief instructions on how to use stop loss orders

Upvotes: 0

Related Questions