INNER CODE UNIT · Python

StrategySaveOHLCVToDF

WISEPLAT/backtrader_bybit · DataExamplesBybit/02 - Symbol data to DF.py:9

class StrategySaveOHLCVToDF(bt.Strategy):
    """Сохраняет OHLCV в DF"""
    params = (  # Parameters of the trading system
        ('coin_target', ''),  #
    )

    def __init__(self):
        self.df = {}
        self.df_tf = {}

    def start(self):
        for data in self.datas:  # Running through all the requested tickers
            ticker = data._name
            self.df[ticker] = []
            self.df_tf[ticker] = self.broker._store.get_interval(data._timeframe, data._compression)

    def next(self):
        """Arrival of a new ticker candle"""

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…