v2 questions

28 Feb 2019, 11:28v2 questions#1
ycompposts: 90since: 16 Oct 2013

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

28 Feb 2019, 11:34#2
Panagiotis Charalampousposts: 2721since: 13 Jan 2017

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


Head of Community Management at cTrader
28 Feb 2019, 11:39#3
ycompposts: 90since: 16 Oct 2013

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?

 

28 Feb 2019, 11:42#4
Panagiotis Charalampousposts: 2721since: 13 Jan 2017

Hi ycomp,

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

Best Regards,

Panagiotis


Head of Community Management at cTrader
28 Feb 2019, 15:00#5
ycompposts: 90since: 16 Oct 2013

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?

 

28 Feb 2019, 15:13#6
Panagiotis Charalampousposts: 2721since: 13 Jan 2017

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


Head of Community Management at cTrader