Decimal Mark Missing

Created at 26 May 2016, 16:48
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!
JO

Jojo_asticot

Joined 13.04.2015

Decimal Mark Missing
26 May 2016, 16:48


Hi, 

When I connect to the API, the JSON datas that I receive are wrong.

It gives me => \"balance\":174325

when it should be \"balance\":1743.25

or \"commission\":-3

for \"commission\":-0.03

The big problem is that it cuts even the 0. So for 150.10 it gives 1501 so I can't just divide everything by 100 as a quick fix.

Thanks for your help.


@Jojo_asticot
Replies

Spotware
26 May 2016, 17:56

Dear Trader,

Could you please send us the request/response example for your issue?


@Spotware

Jojo_asticot
26 May 2016, 21:22

Data for an account

{\"accountId\":***,\"accountNumber\":***,\"live\":true,\"brokerName\":\"IC Markets\",\"brokerTitle\":\"IC Markets\",\"brokerCode\":154,\"depositCurrency\":\"EUR\",\"traderRegistrationTimestamp\":***,\"traderAccountType\":\"HEDGED\",\"leverage\":50,\"balance\":174325,\"deleted\":false,\"accountStatus\":\"ACTIVE\"}

Data for a trade

{\"dealId\":8673365,\"positionId\":22872333,\"orderId\":36837689,\"tradeSide\":\"SELL\",\"volume\":100000,\"filledVolume\":100000,\"symbolName\":\"EURUSD\",\"commission\":-3,\"executionPrice\":1.11921,\"baseToUsdConversionRate\":1.1192,\"marginRate\":1.0,\"channel\":\"cTrader Web\",\"label\":null,\"comment\":null,\"createTimestamp\":1463659042833,\"executionTimestamp\":1463659043113,\"positionCloseDetails\":{\"entryPrice\":1.12182,\"profit\":-233,\"swap\":0,\"commission\":-6,\"balance\":73883,\"balanceVersion\":109,\"comment\":\"positionEntity id 22872333\",\"stopLossPrice\":1.1192,\"takeProfitPrice\":1.1228,\"quoteToDepositConversionRate\":0.89347,\"closedVolume\":100000,\"profitInPips\":-26.1,\"roi\":-0.07115127097850404,\"equityBasedRoi\":-0.07651558637179712,\"equity\":73938}}

Bold is the wrong data.

This is the C# code I use:

WebClient wc = new WebClient();

string content = "";

content = wc.DownloadString(Config.API_HOST + "connect/tradingaccounts/" + Config.ACCOUNT_ID + "/deals?limit=750&oauth_token=" + Config.OAUTH_TOKEN);

 


@Jojo_asticot

Jojo_asticot
31 May 2016, 13:07

Anything yet? 


@Jojo_asticot

Spotware
31 May 2016, 15:56

Dear Trader,

As you can also see in the Schema the balance is monetary type, which contains the monetary amount in cents, penny, etc and is represented using long (int64) data type.

Example: balance:100000, depositCurrency:USD => balance: 1000 USD

The big problem is that it cuts even the 0. So for 150.10 it gives 1501 so I can't just divide everything by 100 as a quick fix

Could you please send us the request/response example showing the above mentioned issue?


@Spotware