最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use TAKE_PROFIT property in binance api - Stack Overflow

programmeradmin2浏览0评论

I used binance api node in my code ()
I wrote javascript code that buy any coin in binance api.
It is working but I am looking for something like stop loss. Opposite of stop loss, like take profit.<br

For example;
Any coin bought at 5 USD. Meanwhile, I want to give a SELL order at 6 USD within BUY order or somewhere.

According to Binance API Document;
Order types (orderTypes, type):
1- LIMIT,
2- MARKET,
3- STOP_LOSS,
4- STOP_LOSS_LIMIT,
5- TAKE_PROFIT,
6- TAKE_PROFIT_LIMIT,
7- LIMIT_MAKER


This is my code;


await client.order({
        symbol: coin_name,
        side: 'BUY',
        type: ' ', // how can i use something like take profit ?
        quantity: (amount/lastPrice).toFixed(3), // max precision is 3 ?
        price: lastPrice.toFixed(3),
        //stopPrice property could be use as take_profit?
    });

When I try to execute "type: TAKE_PROFIT", pile gives an error;
Error message: "Take profit orders are not supported for this symbol."
Error Description: TAKE_PROFIT is not enabled on the symbol

, I search that response json.
There are just 5 types of order type but there is no TAKE_PROFIT as an order type.

I used binance api node in my code (https://github./binance-exchange/binance-api-node)
I wrote javascript code that buy any coin in binance api.
It is working but I am looking for something like stop loss. Opposite of stop loss, like take profit.<br

For example;
Any coin bought at 5 USD. Meanwhile, I want to give a SELL order at 6 USD within BUY order or somewhere.

According to Binance API Document;
Order types (orderTypes, type):
1- LIMIT,
2- MARKET,
3- STOP_LOSS,
4- STOP_LOSS_LIMIT,
5- TAKE_PROFIT,
6- TAKE_PROFIT_LIMIT,
7- LIMIT_MAKER


This is my code;


await client.order({
        symbol: coin_name,
        side: 'BUY',
        type: ' ', // how can i use something like take profit ?
        quantity: (amount/lastPrice).toFixed(3), // max precision is 3 ?
        price: lastPrice.toFixed(3),
        //stopPrice property could be use as take_profit?
    });

When I try to execute "type: TAKE_PROFIT", pile gives an error;
Error message: "Take profit orders are not supported for this symbol."
Error Description: TAKE_PROFIT is not enabled on the symbol

https://api.binance./api/v3/exchangeInfo, I search that response json.
There are just 5 types of order type but there is no TAKE_PROFIT as an order type.

Share Improve this question edited May 9, 2021 at 20:06 sainupangad 1439 bronze badges asked May 9, 2021 at 18:42 tester01tester01 1483 silver badges10 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

TAKE_PROFIT is a valid value in some cases (see Order Types in the docs).

BUT... as the exchangeInfo endpoint suggests, not all order types are valid on all pairs. So if your pair doesn't support the take profit order type, it's limited by Binance and you can't submit this particular order type on this particular pair.

This particular pair might allow other order types - as well as the "take profit" might be allowed on other pairs.


A usual workaround is to submit the order as a regular LIMIT buy order at the intended price (e.g. 100). When the first order is filled, submit a separate LIMIT sell order at the price that you'd consider as a take profit (e.g. 105).

On the Spot Market you can only buy coins with currencies or sell them if you own them. Therefor you can only use MARKET or LIMIT. The other orders are for Futures, where you trade perpetual contracts. With those you can create as example short orders, you sell coins now and buy them in the future. This is where you can use then different order type, such as the mentioned take profit.

发布评论

评论列表(0)

  1. 暂无评论