Replies

bruce.kristelijn
18 Dec 2023, 18:12 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: JSOG get position size in volume

PanagiotisCharalampous said: 

bruce.kristelijn said: 

PanagiotisCharalampous said: 

Hi there,

It's part of the ProtoOAPosition message

Here is the link to the actual message

https://help.ctrader.com/open-api/model-messages/#protooatradedata

Best regards,

Isn't there an payload ID to use? For eg ProtoOAOrderListByPositionIdReq uses payloadType as ‘2179’. What's that for this message?

Hi there,

No because this is not a message, it's a data structure(ProtoOATradeData) which is a member of another data structure(ProtoOAPosition), returned by the ProtoOAReconcileRes

Thank you so much!


@bruce.kristelijn

bruce.kristelijn
18 Dec 2023, 18:12 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: JSOG get position size in volume

PanagiotisCharalampous said: 

bruce.kristelijn said: 

PanagiotisCharalampous said: 

Hi there,

It's part of the ProtoOAPosition message

Here is the link to the actual message

https://help.ctrader.com/open-api/model-messages/#protooatradedata

Best regards,

Isn't there an payload ID to use? For eg ProtoOAOrderListByPositionIdReq uses payloadType as ‘2179’. What's that for this message?

Hi there,

No because this is not a message, it's a data structure(ProtoOATradeData) which is a member of another data structure(ProtoOAPosition), returned by the ProtoOAReconcileRes

Thank you so much!


@bruce.kristelijn

bruce.kristelijn
17 Dec 2023, 19:12 ( Updated at: 21 Dec 2023, 09:23 )

RE: JSOG get position size in volume

PanagiotisCharalampous said: 

Hi there,

It's part of the ProtoOAPosition message

Here is the link to the actual message

https://help.ctrader.com/open-api/model-messages/#protooatradedata

Best regards,

Isn't there an payload ID to use? For eg ProtoOAOrderListByPositionIdReq uses payloadType as ‘2179’. What's that for this message?


@bruce.kristelijn

bruce.kristelijn
14 Dec 2023, 22:25

I haven't found this out myself and am desperate for some help! If there is anyone that can push me in the right direction that would be very helpfull! 😀


@bruce.kristelijn

bruce.kristelijn
09 Dec 2023, 10:28 ( Updated at: 10 Dec 2023, 12:02 )

RE: JSOG get position size in volume

PanagiotisCharalampous said: 

Hi there,

The position's volume is available in ProtoOAPosition.ProtoOATradeData

Best regards,

Panagiotis

Thanks but I am unable to find out how to get this precisely? I am using the JSON API and I cannot find what payload to request to get this?

https://help.ctrader.com/open-api/model-messages/#protooaposition

I've looked at this list and haven't found this yet. Can you help me with that? Thanks!


@bruce.kristelijn

bruce.kristelijn
04 Dec 2023, 23:01

RE: JSON Endpoint Invalid clientRequestId

ridden_topknot0j said: 


Sure, I can help you understand how to resolve the error you're encountering when sending a close request for a position ID.

The error message indicates that the clientRequestId length is invalid. The clientRequestId is a unique identifier for each request that you send to the cTrader API. It must be between 1 and 64 characters long.

To resolve this error, you need to add a clientRequestId to your request. You can generate a unique clientRequestId using any method you like, such as using a UUID generator.

Here is an example of how to modify your request to include a clientRequestId:

JSON

{  "clientMsgId": "",  "clientRequestId": "1234567890abcdef",  "payloadType": 2111,  "payload": {    "ctidTraderAccountId": 31913053,    "positionId": 387499060,    "volume": 1000  }}

Once you have added a clientRequestId to your request, the error should be resolved.

 

 

 

 

 

 

 

 

Thank you so much for getting back to me, however my json looks like this: 

{"clientMsgId": "", "payloadType": 2111, "clientRequestId": "1234567890abcdef", "payload": {"ctidTraderAccountId": 31913053, "positionId": 387499060, "volume": 1000}}

But it still gives me this error:

{'payloadType': 2132, 'clientMsgId': '', 'payload': {'errorCode': 'INVALID_REQUEST', 'ctidTraderAccountId': 31913053, 'description': 'Invalid clientRequestId length: 0. ClientRequestId length must be more then 0 and less or equal then 64'}}

Is there something else I need to do?


@bruce.kristelijn

bruce.kristelijn
19 Apr 2019, 17:21

RE:

Spotware said:

Hi Bruce,

Please make sure third party cookies are not disabled.

Best Regards,

Panagiotis 

Hi,

This worked perfectly! That I didn't though about this earlier, Thanks!


@bruce.kristelijn

bruce.kristelijn
19 Apr 2019, 17:09 ( Updated at: 21 Dec 2023, 09:21 )

RE:

Panagiotis Charalampous said:

Hi Bruce,

Can you please provide us with the following?

  1. Browser and version.
  2. Operating System and version
  3. A screenshot of the error message. 

Best Regards,

Panagiotis 

1. Google Chrome version 73.0.3683.103
2. Windows 10 Version 1809 OS Build 17763.437
3. There is no error message. I click login after entering my credetials and I get redirected back to the login screen


@bruce.kristelijn

bruce.kristelijn
19 Apr 2019, 13:16

RE:

Panagiotis Charalampous said:

Hi Bruce,

Thanks for posting in our community. Can you try a hard refresh (Ctrl+F5) and let me know if this resolves the issue? 

Best Regards,

Panagiotis

Hi, This does not work. I have the same issue on mulitple computers aswell.


@bruce.kristelijn