I see a discrepancy in the values returned from the klines API call.
Here is an example:
API call delivered to the BTC / USDT market.
Candle data appearing on the exchange for open time 2020-12-20 21:26:00:
open = 23832.00
high = 23844.58
low = 23783.86
close = 23788.65
A snapshot of the Binance exchange scene: https://imgur.com/a/DShL7lN
Candle data returned from the API calls for this candle:
open = 23832.00
high = 23844.58
low = 23783.86
close = 23799.72
The near values do not match.
This led to the calculation of an invalid signal. I find there are random differences in the proximity value.
How do I apply for support?
Code to apply kline for the following problematic and valid candle:
from datetime import datetime, timedelta
import time
from datetime import timezone
from binance.client import Client
import pandas as pd
import numpy as np
from pandas_datareader import data
client = Client("", "")
klines = client.get_klines(
symbol = "BTCUSDT",
interval = "1m",
startTime = 1608499560000,
limit = 2
)
labels = ['open_time', 'open', 'high', 'low', 'close', 'volume', 'close_time', '1', '2', '3', '4', '5']
df = pd.DataFrame(klines, columns=labels)
for j in range(0, (df.shape[0])):
print(int(str(df.iloc[j]['open_time'])))
str_open_time = datetime.utcfromtimestamp(int(str(df.iloc[j]['open_time'])[:-3])).strftime('%Y-%m-%d %H:%M:%S')
print("open time: " + str_open_time + "; open: " + str(df.iloc[j]['open']) + "; low: " + str(df.iloc[j]['low']) + "; high: " + str(df.iloc[j]['high']) + "; close: " + str(df.iloc[j]['close']))