I used your code: API_KEY = ''
API_SECRET = ''
import time
import requests
import hmac
import hashlib
import datetime as dt
import pandas as pd



symbol = 'BCH/USDT'
interval = '1m'
lookback = 44640

def get_klines(symbol, interval, lookback):
    url = "https://www.mxc.com/open/api/v2/market/kline"
    end_time = int(time.time() * 1000) # end time is now
    start_time = end_time - (lookback * 60 * 1000) # start time is lookback minutes ago
    query_params = f"?symbol={symbol}&interval={interval}&start_time={start_time}&end_time={end_time}"
    response = requests.get(url + query_params)
    response.raise_for_status()
    data = response.json()['data']
    if not data: # if data is empty, return None
        print('No data found for the given timeframe and symbol')
        return None
    ohlc = []
    for d in data:
        timestamp = dt.datetime.fromtimestamp(d['time']/1000).strftime('%Y-%m-%d %H:%M:%S')
        ohlc.append({
            'Open time': timestamp,
            'Open': float(d['open']),
            'High': float(d['high']),
            'Low': float(d['low']),
            'Close': float(d['close']),
            'Volume': float(d['vol'])
        })
    df = pd.DataFrame(ohlc)
    df.set_index('Open time', inplace=True)
    return df
def signal_generator(df):
    # Calculate EMA and MA lines
    df['EMA5'] = df['Close'].ewm(span=5, adjust=False).mean()
    df['EMA10'] = df['Close'].ewm(span=10, adjust=False).mean()
    df['EMA20'] = df['Close'].ewm(span=20, adjust=False).mean()
    df['EMA50'] = df['Close'].ewm(span=50, adjust=False).mean()
    df['EMA100'] = df['Close'].ewm(span=100, adjust=False).mean()
    df['EMA200'] = df['Close'].ewm(span=200, adjust=False).mean()
    df['MA10'] = df['Close'].rolling(window=10).mean()
    df['MA20'] = df['Close'].rolling(window=20).mean()
    df['MA50'] = df['Close'].rolling(window=50).mean()
    df['MA100'] = df['Close'].rolling(window=100).mean()
    # Extract necessary prices from df
    open_price = df.Open.iloc[-1]
    close_price = df.Close.iloc[-1]
    previous_open = df.Open.iloc[-2]
    previous_close = df.Close.iloc[-2]

    # Calculate the last candlestick
    last_candle = df.iloc[-1]
    current_price = df.Close.iloc[-1]

    # Initialize analysis variables
    ema_analysis = []
    candle_analysis = []

    if (
        df['EMA5'].iloc[-1] > df['EMA20'].iloc[-1] > df['EMA50'].iloc[-1] > df['EMA100'].iloc[-1] > df['EMA200'].iloc[-1] and
        df['EMA5'].iloc[-2] < df['EMA20'].iloc[-2] < df['EMA50'].iloc[-2] < df['EMA100'].iloc[-2] < df['EMA200'].iloc[-2]
    ):
        ema_analysis.append('golden_cross')
    elif (
        df['EMA5'].iloc[-1] < df['EMA20'].iloc[-1] < df['EMA50'].iloc[-1] < df['EMA100'].iloc[-1] < df['EMA200'].iloc[-1] and
        df['EMA5'].iloc[-2] > df['EMA20'].iloc[-2] > df['EMA50'].iloc[-2] > df['EMA100'].iloc[-2] > df['EMA200'].iloc[-2]
    ):
        ema_analysis.append('death_cross')

    if (
        open_price < close_price and
        previous_open > previous_close and
        close_price > previous_open and
        open_price <= previous_close
    ):
        candle_analysis.append('buy')
    elif (
        open_price > close_price and
        previous_open < previous_close and
        close_price < previous_open and
        open_price >= previous_close
    ):
        candle_analysis.append('sell')

    # Generate signal based on strategy
    if 'golden_cross' in ema_analysis and 'buy' in candle_analysis:
        final_signal = 'buy'
    elif 'death_cross' in ema_analysis and 'sell' in candle_analysis:
        final_signal = 'sell'
    else:
        final_signal = ''

    return final_signal

df =  get_klines(symbol, '1m', 44640)


while True:
    df = get_klines(symbol, '1m', 44640) # await the coroutine function here
    if df is not None:
        signal = signal_generator(df)
    if signal is not None:
        print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}:{signal}")
        time.sleep(1)
But I getting ERROR: Traceback (most recent call last):
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 200, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
    raise err
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request  
    raise new_e
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request  
    self._validate_conn(conn)
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn
    conn.connect()
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 604, in connect
    self.sock = sock = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 209, in _new_conn
    raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x00000207C539F850>, 'Connection to www.mxc.com timed out. (connect timeout=None)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\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='www.mxc.com', port=443): Max retries exceeded with url: /open/api/v2/market/kline?symbol=BCH/USDT&interval=1m&start_time=1686080136804&end_time=1688758536804 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000207C539F850>, 'Connection to www.mxc.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\service\.vscode\jew_bot.py", line 103, in <module>
    df =  get_klines(symbol, '1m', 44640)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\service\.vscode\jew_bot.py", line 21, in get_klines
    response = requests.get(url + query_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\api.py", line 59, in request
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\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='www.mxc.com', port=443): Max retries exceeded with url: /open/api/v2/market/kline?symbol=BCH/USDT&interval=1m&start_time=1686080136804&end_time=1688758536804 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000207C539F850>, 'Connection to www.mxc.com timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\service\.vscode\jew_bot.py", line 103, in <module>
    df =  get_klines(symbol, '1m', 44640)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\service\.vscode\jew_bot.py", line 21, in get_klines
    response = requests.get(url + query_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\service\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 507, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='www.mxc.com', port=443): Max retries exceeded with url: /open/api/v2/market/kline?symbol=BCH/USDT&interval=1m&start_time=1686080136804&end_time=1688758536804 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000207C539F850>, 
'Connection to www.mxc.com timed out. (connect timeout=None)'))