INVALID_REQUEST on PROTO_OA_GET_TRENDBARS_REQ
INVALID_REQUEST on PROTO_OA_GET_TRENDBARS_REQ
17 Oct 2024, 03:04
Hi! I'm trying to get historical bar data following https://help.ctrader.com/open-api/symbol-data/#attaining-historical-bar-data. After sending the PROTO_OA_GET_TRENDBARS_REQ message, I get back an OA_ERROR with errorCode: "INVALID_REQUEST" description: "Trading account is not authorized". All the other requests work, including placing an order. My request should contain all the required parameters: {ctidTraderAccountId: ... fromTimestamp: 1688169600000 toTimestamp: 1690848000000 period: M5 symbolId: 1}. Is there any step that I need to take before sending a PROTO_OA_GET_TRENDBARS_REQ message after having been authenticated?
Note: I also sent this message in the Telegram support channel. I'll copy the conversation back here if it happens there first for future reference.
Replies
honfaikan5
17 Oct 2024, 21:09
RE: INVALID_REQUEST on PROTO_OA_GET_TRENDBARS_REQ
Thank you for the reply Panagiotis! It turned out there's a race condition. The application got authenticated but the trendbar request was sent before the confirmation is returned. That's why the other requests were successful. 😅 Thank you again for the support!
PanagiotisCharalampous said:
Hi there,
Did you check the obvious? That the account id is correct?
Best regards,
Panagiotis
@honfaikan5
PanagiotisCharalampous
17 Oct 2024, 07:53
Hi there,
Did you check the obvious? That the account id is correct?
Best regards,
Panagiotis
@PanagiotisCharalampous