ejtraderLabs / ejtraderCT

The best Python Ctrader FIX API Perfect for HFT
MIT License
59 stars 20 forks source link

orders are messed up #33

Open vism211 opened 6 months ago

vism211 commented 6 months ago

hi, could you please explain why the following code is resulting in the 3 orders/positions you can see in the images below?

api = Ctrader(server,account,password)
api.subscribe("EURUSD")
print(api.quote())
print(api.buy(symbol="EURUSD", volume=0.01, stoploss=1, takeprofit=1.5, price=1.08))
api.logout()

ord pos

moreover, the quote() method is returning {}

github-actions[bot] commented 6 months ago

We're glad you've opened your first issue. Please provide all the necessary details and any relevant code or screenshots to help us understand the problem better. Our team will review your issue and provide assistance as soon as possible. Thank you for contributing!

traderpedroso commented 5 months ago

hi, could you please explain why the following code is resulting in the 3 orders/positions you can see in the images below?

api = Ctrader(server,account,password)
api.subscribe("EURUSD")
print(api.quote())
print(api.buy(symbol="EURUSD", volume=0.01, stoploss=1, takeprofit=1.5, price=1.08))
api.logout()

ord pos

moreover, the quote() method is returning {}

Disclosure Due to certain limitations of the FIX API, there's a specific issue that arises when both the Stop Loss (SL) and Take Profit (TP) features are used concurrently. This issue occurs when one of them is triggered, the other remains open and will execute when the price reaches the specified level again, causing it to open another order. This issue needs to be addressed either within the ejtraderCT library or the application itself.

However, you can avoid this problem by using either the SL or TP, but not both simultaneously.