INNER CODE UNIT · Python

week_ago

WISEPLAT/backtrader_moexalgo · DataExamplesMoexAlgo/01 - Symbol.py:20

    week_ago = today - timedelta(days=7)  # a week ago
    days_ago_5 = today - timedelta(days=5)  # three days ago
    days_ago_10 = today - timedelta(days=10)  # ten days ago
    days_ago_N = today - timedelta(days=30)  # N days ago

    # 1. All historical daytime bars for the week
    # data = store.getdata(dataname=symbol, timeframe=TimeFrame.Days, fromdate=week_ago)

    # 2. Historical hour bars with doji of 4 prices (four_price_doji) for the current year
    # data = store.getdata(dataname=symbol, timeframe=TimeFrame.Minutes, compression=60, fromdate=datetime(today.year, 1, 1), todate=datetime(today.year, 12, 31), four_price_doji=True)

    # 3. Historical 30-minute bars from a given date a week ago to the last bar (resample from M10)
    # data = store.getdata(dataname=symbol, timeframe=TimeFrame.Minutes, compression=30, fromdate=week_ago)

    # 4. Historical 5-minute bars of the first hour of the current session without the first 5 minutes (resample из M5)
    # data = store.getdata(dataname=symbol, timeframe=TimeFrame.Minutes, compression=5, fromdate=datetime(today.year, today.month, today.day, 10, 5), todate=datetime(today.year, today.month, today.day, 10, 55))

    # 5. Historical and new 1-minute bars from the beginning of today's session (history + live M1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…