Wrong price while fetching OHLC using api

I am getting result of
“result”: [
{
“close”: 52226.5,
“high”: 52432.5,
“low”: 52224,
“open”: 52420.5,
“time”: 1708298700,
“volume”: 3621
},
{
“close”: 52410.5,
“high”: 52431,
“low”: 52395,
“open”: 52431,
“time”: 1708298400,
“volume”: 1406
},
{
“close”: 52428.5,
“high”: 52428.5,
“low”: 52278.5,
“open”: 52349.5,
“time”: 1708298100,
“volume”: 1592
},
{
“close”: 52351.5,
“high”: 52360.5,
“low”: 52340.5,
“open”: 52356.5,
“time”: 1708297800,
“volume”: 1495
},
{
“close”: 52353.5,
“high”: 52364,
“low”: 52318.5,
“open”: 52318.5,
“time”: 1708297500,
“volume”: 1325
},
{
“close”: 52299.5,
“high”: 52309.5,
“low”: 52266,
“open”: 52308,
“time”: 1708297200,
“volume”: 2648
}
],
“success”: true
}
when fetching OHLC for time stamp Feb 18, 2025, 08:00:00 PM UTC. However the price is going around 1 lakh.

the unix time stamp you are sending corresponds to: GMT : Sunday, February 18, 2024 11:00:00 PM

If there’s a “timestamp issue” when fetching OHLC data, convert unix timestamp to a readable time to identify which time you are passing. you can do this by simply using a unix timestamp converter (can be found on popular search), also can run this code to check timestamps

from datetime import datetime

timestamps = [1708298700, 1708298400, 1708298100, 1708297800, 1708297500, 1708297200]

for ts in timestamps:
    print(datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S UTC'))
type or paste code here

I got. Thanks. This code is works and error identified.

2 Likes