我在获取历史k线时报错
代码如下,循环所有币种,获取历史k线
for symbol in all_symbol:
um_futures_client = UMFutures()
res_kline = um_futures_client.klines(symbol, "1d", limit=240)
换成下边这个接口也是一样的
ret_kline =um_futures_client.continuous_klines(“BTCUSDT”, “PERPETUAL”, “1d”)
报错如下
urllib3.exceptions.SSLError: TLS/SSL connection has been closed (EOF) (_ssl.c:997)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/h/.local/lib/python3.10/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/home/h/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/home/h/.local/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='fapi.binance.com', port=443): Max retries exceeded with url: /fapi/v1/klines?symbol=ETHUSDT&interval=1&limit=240 (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
- 这种问题一般是什么造成的,我在两次调用之间也加了sleep 100ms。
- 我的apikey没有指定ip,这里必须固定ip吗?
- 我是通过vpn连的,请问有影响吗