-
Notifications
You must be signed in to change notification settings - Fork 58
Take Profit and Trailing Stop not working. #7
Comments
I can place stop-loss orders but get the error you describe when trying to place-take profit orders. |
yeah, ive tried every which way i could think of. this link on ftx website https://github.com/ftexchange/ftx. has the same mistake in the comment above, so it seems to be an error made by who ever wrote that for ftx. ill post this on there as well. see if any one from there has had this problem.. |
let you know if anyone gets back to me |
Is the return function in api.py missing the parameters the rest request needs for trailing stop and take profit types.. below? POST /conditional_orders |
Hey ! I'm having the same issue, do you have any news about this take profit error ? |
yes... the code is wrong on this rep. and ftx own rep. i found this in one of ftx pull requests. for some reason nobody has changed the code though. stop markets orders take up to 2 minutes to register on ftx website for me, is this the same for you? type should be "'type': type" return self._post('conditional_orders', |
Well, I spoke with the creator of ftx.py about this issue, he told me that he fixed it. Can't test right now but maybe you can ! |
I tried take profit and trailing stop today at 18.00 roughly. see below. for take profit i got an error of trigger price too high but trigger price needs to be higher than entry for long position. on the trail stop i got an error of must specify trigger. but no trigger is needed for trailing stop... this is using v1.0.2 written by thomgabriel on pycharm. api_conn.api_client().place_conditional_order(market=pair, side='sell', type='take_profit', got below error raise Exception(data['error']) then trailing_stop (with percentage value) api_conn.api_client().place_conditional_order(market=pair, side='sell', type='trailing_stop', error raise Exception(data['error']) |
Do i need to update the library on pycharm? it says 1.0.2 is the latest version |
Well you might need to update the library indeed |
ok... how? the latest version available via pycharm is 1.0.2. maybe quandigital needs to update the version they have released on pycharm? honestly i dont need this anymore. i worked round it.. more trying to get it fixed for others at this point. let me know when the pycharm library has been updated and ill test it |
both trailing stop and take profit work now. but i had to copy api.py file to the pycharm external libraries. |
sorry one thing i had to add to it was 'trailValue' : trail_value into the return self.post(f'conditional_orders'....) on line 157 |
if you look closely the developer of the API actually hardcoded stop orders after checking the type, I realize type is a reserved word in python and it might have been by mistake but common on, this mistake looks like that of a noob. |
Lol. I don't think it's anything to do with being a noob. Its written badly purposefully. I've actually rewrote this code. I will upload it and put a link to it in a few days |
I modified the original library as well, and can now place take_profit order. However once in a while it still get the 'Too High'/'Too low' trigger price error. There is no documentation on the FTX api page about these error. Do you guy have any clue? I might write to support in the end. But seriously this is sucks. |
Not had that problem with take profit. I did with the trailing stop. But that's because I was putting a positive value in for a long trailing stop. I was missing the - operator. All can suggest is check how you work out the take profit figure. Make sure the calculation is correct. |
ok thanks, I'll look into that. |
|
Am I understanding this wrong? |
Also, the orderPrice argument for take profit as limit order was missing, i have sent a pull request now. |
https://github.com/zombiegriff/unofficial_ftx_api its not finished but it works where i need it too. wrote the conditional orders differently. separate functions for place_order, place_stop_order, place_trailing_stop_order, place_take_profit_order |
Nice, I will take a look at it. If I may ask, how are you working around this issue as I realized either of TP/SL orders will be left out in the order book as one gets filled? |
Hi everyone, I'm having an issue with the SL and TP functions of the FTX API. My goal is to create both a SL and TP that will be active once I open a position. for example I place a buy order at 10, when that order gets filled it opens a SL and TP. The issue is that one of the two orders will be on the wrong side for a stop limit, for example price is 10, I wanna buy if the price breaks 11 and in this case place a SL at 10 and TP at 12. Any idea how I could solve this ? |
Also @fahadfadi you can use the 'reduceOnly': True so that if you have no position outstanding it will cancel the orders |
Has anyone already been able to fix the problem with "trigger price is too high"? |
"""
To send a Stop Market order, set type='stop' and supply a trigger_price
To send a Stop Limit order, also supply a limit_price
To send a Take Profit Market order, set type='trailing_stop' and supply a trigger_price
To send a Trailing Stop order, set type='trailing_stop' and supply a trail_value
"""
This is commented in the api.py. Every way i try to post a take profit or trailing stop or even a stop (as a take_profit value) i receive an error, usually saying the trigger price is too high, which is not possible when putting a take profit on a long position.
Has anyone else had similar issues with placing orders?
Appreciate any suggestions. Thanks
The text was updated successfully, but these errors were encountered: