vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

vbt.BinanceData.download do not accept klines_type parameter

Open keiser1080 opened this issue 2 years ago • 8 comments

Hi,

i am trying to download binance future klines, but i get the error TypeError: download_symbol() got an unexpected keyword argument 'klines_type' https://github.com/sammchardy/python-binance/blob/8cac5eac94b71af6532aef128a8c815d7fc0c617/binance/client.py#L870

from binance.enums import HistoricalKlinesType
symbols = ["BTCUSDT"]
startDate = "2020-12-01"

endtDate = "now UTC"
timeInterval = "1h"
binance_data = vbt.BinanceData.download(

            symbols=symbols,
            start=startDate,
            # end=endtDate,
            interval=timeInterval,
            klines_type = HistoricalKlinesType.FUTURES
            
        )
binance_data = binance_data.update()
binance_data.get()

keiser1080 avatar Mar 01 '22 01:03 keiser1080

Arguments to the client can be provided using client_kwargs.

Edit: I now see that it's passed not to the client but to the method. I need to add support for it.

polakowo avatar Mar 01 '22 12:03 polakowo

TypeError: download_symbol() got an unexpected keyword argument 'client_kwargs klines_type it hink it's not a client argument but a get_klines methode argument

keiser1080 avatar Mar 01 '22 12:03 keiser1080

client_kwargs is in fetch, not fetch_symbol. Don't use fetch_symbol, it's mostly for internal use.

polakowo avatar Mar 01 '22 12:03 polakowo

client_kwargs

i don't use fetch symbole. i am using download

from binance.enums import HistoricalKlinesType
symbols = ["BTCUSDT"]
startDate = "2022-03-01"

endtDate = "now UTC"
timeInterval = "1h"
binance_data = vbt.BinanceData.download(

            symbols=symbols,
            start=startDate,
            # end=endtDate,
            interval=timeInterval,
            # client_kwargs=dict(klines_type = HistoricalKlinesType.FUTURES)
            
        )
binance_data = binance_data.update()
binance_data.get()

keiser1080 avatar Mar 01 '22 12:03 keiser1080

As said, you can't pass klines_type just yet, I need to manually enable it.

polakowo avatar Mar 01 '22 12:03 polakowo

As said, you can't pass klines_type just yet, I need to manually enable it.

ok thanks, as workaround i will use cctx binance data:

symbols = ["BTCUSDT"]
startDate = "2022-03-01"

endtDate = "now UTC"
timeInterval = "1h"
ccxt_data = vbt.CCXTData.download(
             symbols,
             start='2 hours ago UTC',
             end='now UTC',
             timeframe=timeInterval,
             config = {
        'defaultType': 'future'}
         )
ccxt_data.get()

keiser1080 avatar Mar 01 '22 12:03 keiser1080

@polakowo Any update on allowing us to pass klines_type?

piotryordanov avatar Jun 22 '22 06:06 piotryordanov

klines_type is not required. you can pass exchange='binanceusdm' to get the futures prices. list of supported exchanges can be taken from ccxt.exchanges

madhurmehta-sahi avatar Dec 22 '22 10:12 madhurmehta-sahi