0

I have problem with python-binance library. I want to get candles from testnet but the recieved candles are same with original binance.

this is my code :

from binance.client import Client

def get_candles(api_key, api_secret, symbol, time_frame, start_time):
    client = Client(api_key=api_key, api_secret=api_secret, testnet=True,                        base_endpoint='https://testnet.binancefuture.com')
    response = client.get_historical_klines(symbol=symbol, interval=time_frame, start_str=start_time)
    all_candles = []
    for candle in response:
        candle_data = {
            "open_time": candle[0],
            "open_price": float(candle[1]),
            "high_price": float(candle[2]),
            "low_price": float(candle[3]),
            "close_price": float(candle[4]),
            "volume": float(candle[5]),
            "close_time": candle[6],
            "quote_asset_volume": float(candle[7]),
            "number_of_trades": int(candle[8]),
            "taker_buy_base_asset_volume": float(candle[9]),
            "taker_buy_quote_asset_volume": float(candle[10])
        }

        all_candles.append(candle_data)

    return all_candles

0 Answers0