For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Oanda Candles History Download



  • Hi!
    I am new in BT and have quite simple question:
    Try to get candles 1m from Oanda with:

    cerebro = bt.Cerebro()
    storekwargs = dict(
    token='my token',
    account='acc nr',
    practice=False
    )
    StoreOandav20= btoandav20.stores.OandaV20Store(**storekwargs)
    DataOandav20 = btoandav20.feeds.OandaV20Data(**storekwargs)
    cerebro.broker = StoreOandav20.getbroker()

    data0 = StoreOandav20.getdata(dataname="GBP_USD", timeframe=bt.TimeFrame.Ticks, compression=1, backfill_start=False, backfill=False)
    data1 = cerebro.resampledata(data0, timeframe=bt.TimeFrame.Minutes, compression=5)
    data2 = StoreOandav20.getdata(dataname='EUR_USD',
                           compression=1,
                           backfill=True,
                           fromdate=datetime.datetime(2017, 11, 1),
                           todate=datetime.datetime(2017, 12, 31),
                           qcheck=0.5,
                           timeframe=bt.TimeFrame.Ticks,
                           backfill_start=False,
                           historical=True)
    cerebro.addstrategy(TestStrategy)
    cerebro.adddata(data1)
    cerebro.run()
    

    How I can extract candles from this data0,data1,data2?



  • You can use simple strategy which will go thru the data feeds and every next() print available prices.

    Another way - obtain cerebro results after run and extract data feeds from the strategies returned.


Log in to reply
 

});