Jump to content
Cinemizer

ClientAccountMargin Shows different values

Recommended Posts

Hi,

I have placed more trades (Forex CFD UK plattform EUR/USD market) and reading in every second by GET https ClientAccountMargin:

GET https://ciapi.cityindex.com/TradingAPI/margin/ClientAccountMargin

The value "Cash" is on my Web Trading plattform is 11038,70 EUR and it is stable, not changing, during all trades are waiting to be executed,
but the return value from GET is: 11054.40 and is continously changing, during the open trades are waiting to be executed.

It seems, that the "Cash" value on the GET answer is moving according the current EUR/USD price, but is should not.
It must be constant, like on the web plattform, but it is not.

Why?

What shall I do to have the same non changing "Cash" answer value, getting by https GET
as showed on the top of the web plattform ?

THX !

Share this post


Link to post

IN the mean time, since about 1 hour the Cash value on my webtrading plattform is: 11045,76 Euro
but the answer from GET https ClientAccountMargin  is: 11028,02 Euro.

And one more very interesting thing:
If I close all orders and all trades on my EUR/USD market and having no orders or trades on other markets, (it means, I have no positions or orders anywhere)
the "Cash" value from GET https ClientAccountMargin  is changing after every GET request, (which I make in about every second).

Why?

THX !

Share this post


Link to post

Hello,

In answer to the question in your first post. 

The "Cash" displayed on the Web Trader platform is streamed and does not use the REST API GetClientAccountMargin call. The Cash value from the stream on the Web platform is updated after you close/modify your open positions.

The GetClientAccountMargin call retrieves the latest current values for your account. That is why if you have open positions and are calling it repeatedly every second, then it will show the latest current value, which will change over time since you have open positions. This is not the recommended way. You should subscribe to the Lightstreamer ClientAccountMargin stream instead.

Kind Regards, PM 

Share this post


Link to post

Hi,

For the question in your 2nd post. I presume you meant the Cash values change immediately after you close all your open positions?

This is because the back-end processes/calculates your new cash value for each open positoin closed separately, and there is a lag time time to the calculations. Since you are refreshing the APi call every second, you are seeing the Cash value update while it is still calculating the changes from each closed position.

The value should stabilise after a short while to the final value of your Cash balance once the back-end has computed your final value from all the closed positions.

Just one query: are you using a demo account for your testing? It is recommended you use a demo account while you are testing and setting up your system so you do not use your real-money account until you are ready to Live trade.

Kind Regards,

PM

Share this post


Link to post

Yes, I am using a demo account, not to risk real money.

But there is something wrong.

You told me, that on Web Plattform, the Cash changes only if a trade was executed, and requesting the Cash by ClientAccountMargin is taking a time, while in the background it will be calculated, but it seems not be true. I know about it and I am waiting a while, till I expect, that the right Cash value comes also from ClientAccountMargin, BUT!

1. If I have an open position, Cash return value from ClientAccountMargin must stabilise after a while, (you told me), but it do not do that. It is changing after every query, (I ask every second)
(During no trade will be executed)

2. If I close all positions, it means, everything is clear and free and I get every second a query of ClientAccountMargin, the Cash value is changing continously. Also after 5 Minuten.(I expect, that after few seconds it should stabilise) but NOT ! (The changes are about between 0,1 - 0,3 Euros, not much, but continously changing !!!) The Cash value on Web Surface is stable.

3. Why is the Cash value getting by ClientAccountMargin different like the Cash value on the Web surface ? I.e. now I have on web surface: 11002,97 Euro stable, not changing, but Cash by ClientAccountMargin return is:11004.09,  11003.26,  11003.12,  11003.02,  11003.54... changing continously, but I have no open positions at all !!!

THX !

Share this post


Link to post

Hi,

Since you are using a demo account, please send me a private message with your account credentials. I can use your account and make some test calls and investigate what happens.

Thank you, PM

Share this post


Link to post

How can I send you a private message ?

Or what is your Email address ?

If you check my demo account, you will not see much about it, because it is showing the right Cash, stable.
The problem causes the GET https ClientAccountMargin which is returning changing values, even if I have no open trade or order.

TXH!

Share this post


Link to post

Hover you rmouse pointer over my user name on one of my posts. a popup will appear. At the bottom left is a message icon. Click on that to open a message window. 

I'll investigate by using your test account to send repeated GET HTTP calls and see what results are returned.

image.png

Share this post


Link to post

Hello @Cinemizer,

Your account is papered under the FOREX.com UK brand, which is setup to be in pound sterling. However, the account currency of your account is in Euros. 

Whenever you are calling the GetClientAccountMargin call, your cash value is converted from GBP to EUR using the latest live cross-currency rate. That is why with each call you see your cash balance change by a little bit, due to the constantly changing EUR/GBP exchange rate.

If you use the streamed cash balance via Lightstreamer, that will resolve the issue.

Kind Regards, PM

 

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×