API Support Forum
OEC API > API Support > Open position P/L issue
Author Topic: Open position P/L issue
(10 messages, Page 1 of 1)
Moderators: VPfau
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Nov 30, 2020 @ 03:50 PM             Msg. 1 of 10
Hi guys!

Maybe we found a possible bug:

We tried to open a position using the OEC API (3.5), so we closed the connection and reconnected to the same account using the new GF API 4.0.
The position does not receive the P/L update (GF API 4.0) if it was initially opened with the OEC API. The AvgPositionChanged event is not raised to update Open P/L.

Everything works if the position is initially opened with GF API 4.0 instead of OEC API 3.5.

There seems to be some incompatibility issue between the two API versions if the position is initially opened with the OEC API.

Unfortunately for this reason we were forced to immediately revert to the old OEC API until this problem is fixed. Many of our users use different applications and have reported this issue to us and we were able to reproduce it immediately too. For example, they open a position with an application (for example OEC Trader 3.5) and manage it with our application (Overcharts) which uses the new GF API 4.0.
GF API version is the very latest available with Gain Trader Developer 4.0.

Thank you for you help.
Mauro frasson

Edited by MFrasson3344 on Nov 30, 2020 04:33 PM
CMicciche902
Posts: 367
Joined:


Posted: Dec 01, 2020 @ 09:38 AM             Msg. 2 of 10
Mauro,

I'm not seeing this issue with OEC Trader 3.5 uses OECAPI and then disconnecting and establishing connection with GAIN Trader 4.0 uses GFAPI. Can you provide more detail for us to troubleshoot? Did you experience this issue on api.gainfutures.com or other server? Which username? If you need to send live username or account number, send to GFSupport at Gaincapital.com
Chris M
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Dec 01, 2020 @ 10:07 AM             Msg. 3 of 10
Hi Chris,

I tried now another time with my developer account (but it also happens with real accounts for this reason I suspect it is a GF API 4.0 issue), and it seemed to work because today I had not opened and closed the position previously.
So I have opened and closed the same position several times using OEC API. Then I opened it with OEC API. I logged out from OEC API and reconnected with GF API and the issue occurred.

The issue probably occurs if the position has already been opened and closed multiple times (or at least one) during the day.

So try to open and close the position 2 or 3 times with OEC API. Then open it again always with OEC API. Then log out from OEC API and reconnect with GF API.
Mauro frasson
SRuscak
Posts: 50
Joined: Aug 24, 2017


Posted: Dec 01, 2020 @ 10:31 AM             Msg. 4 of 10
>GF API version is the very latest available with Gain Trader Developer 4.0.
I will note that there is no GF API available with Gain Trader. The public version we support is available on nuget: https://www.nuget.org/packages/GFAPI/
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Dec 01, 2020 @ 10:46 AM             Msg. 5 of 10
Yes I know about the GF API on nuget, but you have built them by merging many other dlls under a single dll and this does not work with dynamic loading of dlls. So I get the single dlls from Gain Trader. Actually the issue also occurs with July dll releases (or maybe earlier).
Mauro frasson
CMicciche902
Posts: 367
Joined:


Posted: Dec 01, 2020 @ 11:05 AM             Msg. 6 of 10
I can try that. However, we have numerous clients that have used OECAPI with 3rd party platform and GAIN Trader 4.0 with no issues over the last year. Do you experience the same issue with OEC Trader 3.5 and GAIN Trader 4.0?

3.5 version - https://api.gainfutures.com/WebAPI/api/Files/DownloadClientUpdate?clientUpdateId=1990
4.0 version - https://api.gainfutures.com/WebAPI/api/Files/DownloadClientUpdateLast?brandId=0&clientTypeId=0&branchId=2
Chris M
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Dec 01, 2020 @ 11:23 AM             Msg. 7 of 10
I have tried right now with Gain Trader 4.0 and it works (Open P / L is updated). I'll try to use the GF API nuget version and see what happens.
Mauro frasson

Edited by MFrasson3344 on Dec 01, 2020 11:23 AM
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Dec 01, 2020 @ 05:46 PM             Msg. 8 of 10
I investigated more and understood what is the exact issue of why Open P/L does not update:
It seems that the GF API does not automatically subscribe to the quotes for instruments with the position open (which OEC API does instead). Did I forget to set some parameters or is it really necessary to subscribe the quotes manually to have the Open P/L updated?
Mauro frasson
SRuscak
Posts: 50
Joined: Aug 24, 2017


Posted: Dec 02, 2020 @ 07:41 AM             Msg. 9 of 10
Mauro,

You are correct, this is a difference between OEC API and GF API. In GF API the client chooses how to use the limited number of subscriptions available to it.
MFrasson3344
Posts: 45
Joined: Nov 09, 2015


Posted: Dec 02, 2020 @ 07:58 AM             Msg. 10 of 10
Ok perfect, thanks.
No problem managing subscriptions manually. If it is not already written in the documentation it is an important thing to add.
Mauro frasson