Closed Azuriye closed 5 months ago
I'm struggling to get the correct OHLC values from the most recent bar.
from oandapyV20 import API from oandapyV20.endpoints.instruments import InstrumentsCandles accountID = "" access_token = "" api = API(access_token=access_token, environment="practice") instrument = "EUR_JPY" granularity = "M15" params = { "count": 1, "granularity": granularity, } candles_request = InstrumentsCandles(instrument=instrument, params=params) try: response = api.request(candles_request) historical_data = response.get("candles", []) for candle in historical_data: print(f"Time: {candle['time']}, Open: {candle['mid']['o']}, High: {candle['mid']['h']}, Low: {candle['mid']['l']}, Close: {candle['mid']['c']}") except Exception as e: print(f"Error: {e}")
This is the print statement: Time: 2024-01-26T21:45:00.000000000Z, Open: 160.778, High: 160.829, Low: 160.733, Close: 160.813
Time: 2024-01-26T21:45:00.000000000Z, Open: 160.778, High: 160.829, Low: 160.733, Close: 160.813
But on my MT4 M15 EURJPY Chart, it shows
Am I doing something wrong from my side?
I'm struggling to get the correct OHLC values from the most recent bar.
This is the print statement:
Time: 2024-01-26T21:45:00.000000000Z, Open: 160.778, High: 160.829, Low: 160.733, Close: 160.813
But on my MT4 M15 EURJPY Chart, it shows![image](https://github.com/hootnot/oanda-api-v20/assets/75412786/5f7c634f-850a-4127-958a-240e2c78d4e6)
Am I doing something wrong from my side?