v2 questions

Created at 28 Feb 2019, 11:28
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!
YC

ycomp

Joined 16.10.2013

v2 questions
28 Feb 2019, 11:28


Hi, some questions about Open API v2

1) can I keep my accounts API code as-is for now and first try to port over the trading api code from v1 to v2? I mean update proto files and rework trading api code to use the v2 proto? then once that is working I can try to eliminate the accounts API code and convert it to trading api code as well? do you see any problems with this approach?

2) is there an updated java OpenAPIMessagesFactory.java file ? it is in the samples on github but is from 2015 so I'm sure this is the v1 version


@ycomp
Replies

PanagiotisCharalampous
28 Feb 2019, 11:34

Hi ycomp,

1) I do not see any problems either. v1 and v2 will work in parallel for now. 

2) The java sample for v2 is here.

Best Regards,

Panagiotis


@PanagiotisCharalampous

ycomp
28 Feb 2019, 11:39

Hi,

can I use the new .proto v2 files with v1 trading api code?

I mean the code I have for trading api v1 , just replace the proto files and it should still work?

 


@ycomp

PanagiotisCharalampous
28 Feb 2019, 11:42

Hi ycomp,

You will need to generate new classes from the new proto files and adjust your code accordingly. 

Best Regards,

Panagiotis


@PanagiotisCharalampous

ycomp
28 Feb 2019, 15:00

in v1 trading api (with java) the way to send and receive messages was to have a message sender thread and message receiver thread running. You send messages on the sender thread and receive them on the receiver thread.

Can I still use this approach with v2? Or do I need to use this netty like in the java examples and open a new connection and wait for the result each time I want to make a request?

 


@ycomp

PanagiotisCharalampous
28 Feb 2019, 15:13

Hi ycomp, 

Unfortunately I cannot advise you about Java, I am a .Net guy. However v2 is based on the same technology as v1. It just features more messages and changes to some existing ones. Also I don't think this this is an API issue but a matter of your application architecture. My proposal is to have a connection established all the time which will be used to send and receive messages. You will need to send heartbeats to the server to keep the connection open and have a listener which will listed constantly to incoming messages. If you are familiar with .Net, you can have a look at the .Net Sample.

Best Regards,

Panagiotis


@PanagiotisCharalampous