NormalizeVolume in connect API

Created at 27 Jul 2017, 13:15
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!
obaum1@gmail.com's avatar

obaum1@gmail.com

Joined 06.06.2017

NormalizeVolume in connect API
27 Jul 2017, 13:15


Hey Guys :)

Is there a function that normalize the volume like the one in the cAlgo API(NormalizeVolume(double, RoundingMode))?

If not, how can i create one? what is it a normal amount in each size?

 

Thanks!!!


@obaum1@gmail.com
Replies

Spotware
27 Jul 2017, 14:39

Hi obaum1,

Connect API does not offer this function. However, normalization requires a simple function like the following

 normalizedVolume = ((int)(volume / step) * step);

The Symbol's step is provided by the Accounts API. You can get it using  the following request

https://sandbox-api.spotware.com/connect/tradingaccounts/89214/symbols?oauth_token=test002_access_token 

Based on your needs you can replace (int) with Math.Floor() or Math.Ceiling(). You can also add conditions for minimum and maximum quantity.

Best Regards,

cTrader Team


@Spotware