How to set market take profit?
See original GitHub issueThe code as follows:
import ccxt
import time
from pprint import pprint
ftx = ccxt.ftx({
'apiKey': 'my_apikey',
'secret': 'my_secret',
})
symbol = 'BTC/USD:USD'
ftx.load_markets()
market = ftx.market(symbol)
btc_maket_price = float(market['info']['price'])
btc_amount = 20 / btc_maket_price
create_order = ftx.create_order(symbol, 'market', 'buy', btc_amount)
type = 'takeProfit'
side = 'sell'
rise_btc_price = btc_maket_price + btc_maket_price * 0.015
params = {
'stopPrice': rise_btc_price,
}
order = ftx.create_order(symbol, type, side, btc_amount, params)
The errors as follows: Traceback (most recent call last): File “C:\Users\fxu50\PycharmProjects\pythonProject1\contract.py”, line 26, in <module> order = ftx.create_order(symbol, type, side, btc_amount, params) File “C:\Users\fxu50\PycharmProjects\pythonProject1\ccxt\ftx.py”, line 1625, in create_order raise InvalidOrder(self.id + ’ createOrder() does not support order type ’ + type + ‘, only limit, market, stop, trailingStop, or takeProfit orders are supported’) ccxt.base.errors.InvalidOrder: ftx createOrder() does not support order type takeProfit, only limit, market, stop, trailingStop, or takeProfit orders are supported
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
What Take Profit Orders Are & How to Set Them as a Pro Trader
One of the best approaches is to use your risk-reward ratio to set your take profit. For example, if you only risk 5%...
Read more >Take-Profit Order (TP): Definition, Use in Trading, and Example
A take-profit order (T/P) is a limit order that specifies that price at which to exit a position for a profit.
Read more >How do I set Stop Loss and Take Profit when placing an order?
Take Profits allow the user to maximize profit by exiting a trade as soon as the market is at a favorable price. What...
Read more >How to Set Stop-Loss & Take-Profit Targets | eToro
A take-profit order closes your open position for a profit once it reaches a predetermined percentage of profit or monetary value. It removes...
Read more >What Is a Take-Profit Order? - The Balance
A take-profit order is a standing order put in place by traders to maximize their profits. It specifies a certain price above the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It is ok now.
@qwe231cvb you’re making a market takeProfit order, so you have to specify price=None or the actual limit price:
Hope that answers your question.