Exclusive closing position

Created at 01 Apr 2020, 22:13
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RI

Rimokatolik

Joined 12.02.2019

Exclusive closing position
01 Apr 2020, 22:13


I am using new single order (D) to open and close position. When I want to close existing position I need to set 721 PosMaintRptID of the existing position. However, I noticed that even if position does not exist order will be filled. FIX spec just says: "Position ID, where this order should be placed. If not set, new position will be created, it’s id will be returned in ExecutionReport(8) message. Can be specified only for Hedged accounts." So it was not clear that non-existing position can be specified. It may be wrong position id, or sending order to close already closed position. Is there a way to fail order if position does not exist?

 

Thank you


@Rimokatolik
Replies

PanagiotisCharalampous
02 Apr 2020, 08:48

Hi Rimokatolik,

No there is no such option for FIX API. You need to handle this case on your side.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

Rimokatolik
11 May 2020, 17:23

RE:

Can you please explain how come I get BUSINESS_MESSAGE_REJECT (j) message with Text (58) = INCORRECT_POSITION_ID:Unknown position. PositionId=203255, after I have successfully closed that position 203255?

Thank you


@Rimokatolik

PanagiotisCharalampous
12 May 2020, 08:13

Hi Rimokatolik,

Please provide the sequence of FIX messages that lead to receiving this message.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous