Bosko
Bosko

Reputation: 1

XTB API open and close prices calculation

I am using xtb api documentation to build a trading bot. Everything seems fine for now except open/close price calculation.

As mentioned in the documentation "Price values must be divided by 10 to the power of digits in order to obtain exact prices."

Ask and bid are returning current price correctly but for day open and day closed values I need to calculate somehow using the suggestion from the docs.

Values for open, close are way off, as I understand, those are not values but swings from previous open price, so I am not sure how to get to the correct value, the actual price.

I want to calculate day price movement in percentage, so I need closing price from yesterday and close price from today.

Getting correct close and open price values will help me fix macd and rsi calculations as well but I cant seem to wrap my mind around how is this being transformed into an actual price. (open and close prices values for each symbol)

Need to transform open and close values into an actual price: Format of RATE_INFO_RECORD

{
**"close": 1.0,**
"ctm": 1389362640000,
"ctmString": "Jan 10, 2014 3:04:00 PM",
"high": 6.0,
"low": 0.0,
**"open": 41848.0,**
"vol": 0.0
} 

This is how I currently transform close prices, but the values are still not correct.

Upvotes: 0

Views: 122

Answers (1)

Ondřej Novák
Ondřej Novák

Reputation: 1

Today I received an email saying that xtb is going to close its API on March 14, 2025. So choose a competitor

Upvotes: 0

Related Questions