ProtoOaOrderErrorEvent POSITION_NOT_FOUND | ORDER_NOT_FOUND

Created at 13 May 2024, 16:52
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!
raul_gherman's avatar

raul_gherman

Joined 01.03.2024

ProtoOaOrderErrorEvent POSITION_NOT_FOUND | ORDER_NOT_FOUND
13 May 2024, 16:52


Isn't the position_id field supposed to be populated if POSITION_NOT_FOUND error_code is returned by ProtoOaOrderErrorEvent?

Should this be covered by API (I think it is, right?), or it depends, it is something that broker can control?

(ProtoOaVersion 90)

 

ProtoOaOrderErrorEvent {
   payload_type: None,
   ctid_trader_account_id: 000redacted000,
   error_code: "POSITION_NOT_FOUND",
   order_id: Some(
       0,
   ),
   position_id: Some(
       0,
   ),
   description: Some(
       "Position not found with id 2416447",
   ),
}

 

if error_code is ORDER_NOT_FOUND, order_id field seems to be properly populated:

ProtoOaOrderErrorEvent {
   payload_type: None,
   ctid_trader_account_id: 000redacted000,
   error_code: "ORDER_NOT_FOUND",
   order_id: Some(
       4747037,
   ),
   position_id: None,
   description: Some(
       "Order not found with id 4747037",
   ),
}

Thank you!


@raul_gherman
Replies

raul_gherman
06 Jun 2024, 12:03 ( Updated at: 06 Jun 2024, 13:53 )

@PanagiotisCharalampous could you pls advise on this one?


@raul_gherman

raul_gherman
22 Jul 2024, 11:49

@spotware support, could you please take a look at this topic?

topic raised more than 2 months ago, in the mean time v9.1 was released, issue still relevant.

could you please take a look, or at least reply here that it is going to be addressed or not?


@raul_gherman

PanagiotisCharalampous
23 Jul 2024, 06:36

Hi Raul,

I have forwarded this issue to the product team. I will update the thread when I receive a response.

Best regards,

Panagiotis


@PanagiotisCharalampous

raul_gherman
01 Aug 2024, 13:12 ( Updated at: 01 Aug 2024, 13:13 )

here is another interesting (yet I think related) one:

2024-08-01 11:00:02.817977 0ms ERROR tokio-runtime-worker [src/process_message_stream.rs:204] ProtoOaOrderErrorEvent {
    payload_type: None,
    ctid_trader_account_id: 40xxxx09,
    error_code: "CONCURRENT_MODIFICATION",
    order_id: Some(
        0,
    ),
    position_id: Some(
        0,
    ),
    description: None,
}

 

returning CONCURRENT_MODIFICATIONin ProtoOaErrorEvent is correct, still order_id and / or position_id fields should be filled up;

processing an order / position request should result in either a ProtoOaExecutionreport in case of successful processing operation, or a ProtoOaErrorEvent in case of an insuccessful such operation, mentioning order or position ID and the reason / cause of failure in description field;

current setup also returns CONCURRENT_MODIFICATION in error_code of execution report (sample below), so required data to properly populate necessary fields is already present:

2024-08-01 11:00:01.415653 0ms INFO tokio-runtime-worker [src/symbol/process_execution_event.rs:46] ProtoOaExecutionEvent {
    payload_type: None,
    ctid_trader_account_id: 40xxxx09,
    execution_type: OrderCancelRejected,
    position: Some(
        ProtoOaPosition {
            position_id: 4xxxxxxx2,
            trade_data: ProtoOaTradeData {
                symbol_id: 2,
                volume: 0,
                trade_side: Buy,
                open_timestamp: None,
                label: Some(
                    "00c7427b60a176ed4fe104d122af0a04",
                ),
                guaranteed_stop_loss: Some(
                    false,
                ),
                comment: None,
                measurement_units: Some(
                    "GBP",
                ),
                close_timestamp: None,
            },
            position_status: PositionStatusCreated,
            swap: 0,
            price: Some(
                0.0,
            ),
            stop_loss: None,
            take_profit: None,
            utc_last_update_timestamp: None,
            commission: Some(
                0,
            ),
            margin_rate: Some(
                0.0,
            ),
            mirroring_commission: Some(
                0,
            ),
            guaranteed_stop_loss: Some(
                false,
            ),
            used_margin: Some(
                2552,
            ),
            stop_loss_trigger_method: None,
            money_digits: Some(
                2,
            ),
            trailing_stop_loss: None,
        },
    ),
    order: Some(
        ProtoOaOrder {
            order_id: 7xxxxxxx0,
            trade_data: ProtoOaTradeData {
                symbol_id: 2,
                volume: 1000000,
                trade_side: Buy,
                open_timestamp: Some(
                    17xxxxxxx11,
                ),
                label: Some(
                    "00c7427b60a176ed4fe104d122af0a04",
                ),
                guaranteed_stop_loss: Some(
                    false,
                ),
                comment: None,
                measurement_units: Some(
                    "GBP",
                ),
                close_timestamp: None,
            },
            order_type: Limit,
            order_status: OrderStatusAccepted,
            expiration_timestamp: None,
            execution_price: None,
            executed_volume: Some(
                0,
            ),
            utc_last_update_timestamp: Some(
                17xxxxxxx20,
            ),
            base_slippage_price: None,
            slippage_in_points: None,
            closing_order: Some(
                false,
            ),
            limit_price: Some(
                1.27648,
            ),
            stop_price: None,
            stop_loss: None,
            take_profit: None,
            client_order_id: Some(
                "77b811aa-2464-4e49-b5ed-296731464224",
            ),
            time_in_force: Some(
                GoodTillCancel,
            ),
            position_id: Some(
                4xxxxxxx2,
            ),
            relative_stop_loss: None,
            relative_take_profit: None,
            is_stop_out: None,
            trailing_stop_loss: None,
            stop_trigger_method: None,
        },
    ),
    deal: None,
    bonus_deposit_withdraw: None,
    deposit_withdraw: None,
    error_code: Some(
        "CONCURRENT_MODIFICATION",
    ),
    is_server_event: Some(
        false,
    ),
}

 

 

 


@raul_gherman

raul_gherman
01 Aug 2024, 13:12 ( Updated at: 01 Aug 2024, 18:18 )

… duplicate post, I suppose…

 

 


@raul_gherman

PanagiotisCharalampous
19 Aug 2024, 05:14

Hi Raul,

The team confirmed this is a bug and it will be solved in an upcoming update.

Best regards,

Panagiotis


@PanagiotisCharalampous

raul_gherman
03 Sep 2024, 08:05

version 92:

2024-09-03 06:30:00.519943 0ms ERROR main [src/websocket/process_message_stream.rs:206] ProtoOaOrderErrorEvent {
    payload_type: None,
    ctid_trader_account_id: 4xxxxxx2,
    error_code: "ORDER_NOT_FOUND",
    order_id: None,
    position_id: None,
    description: Some(
        "Order with orderId:5140987 isn't found",
    ),
}

@raul_gherman