Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. etcetc
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    E
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 10
    • Best 0
    • Groups 0

    etcetc

    @etcetc

    0
    Reputation
    421
    Profile views
    10
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    etcetc Unfollow Follow

    Latest posts made by etcetc

    • RE: Oanda live data - open, close, high, low are the same

      @backtrader I see. I have been playing around with the values trying to match the behavior that was described in the docs.

      However I'm running into some issues - here is my call to oandatest.py

      python oanda.py --token XXX --account 1401188 --data0 EUR_USD --timeframe Minutes --compression 60 --replay
      

      From what I understand my prenext and next calls should be called every minute. However, my data output is as follows:

      -- Contract Details:
      {u'pip': u'0.0001', u'instrument': u'EUR_USD', u'maxTradeUnits': 10000000, u'displayName': u'EUR/USD'}
      Datetime, Open, High, Low, Close, Volume, OpenInterest, SMA
      ***** DATA NOTIF: DELAYED
      Data0, 0021, 736447.833333, 2017-04-28T20:00:00.000000, 1.089340, 1.090030, 1.088955, 1.089620,    423, 0, 1.089734
      Data0, 0022, 736449.875000, 2017-04-30T21:00:00.000000, 1.091305, 1.091305, 1.089240, 1.089750,    339, 0, 1.089668
      Data0, 0023, 736449.916667, 2017-04-30T22:00:00.000000, 1.089710, 1.090345, 1.089520, 1.090245,    396, 0, 1.089683
      Data0, 0024, 736449.958333, 2017-04-30T23:00:00.000000, 1.090265, 1.091120, 1.090265, 1.090590,    258, 0, 1.089904
      Data0, 0025, 736450.000000, 2017-05-01T00:00:00.000000, 1.090615, 1.090790, 1.089965, 1.089965,    241, 0, 1.090034
      Data0, 0026, 736450.041667, 2017-05-01T01:00:00.000000, 1.089985, 1.090080, 1.088930, 1.089280,    475, 0, 1.089966
      Data0, 0027, 736450.083333, 2017-05-01T02:00:00.000000, 1.089300, 1.089695, 1.089235, 1.089385,    201, 0, 1.089893
      Data0, 0028, 736450.125000, 2017-05-01T03:00:00.000000, 1.089365, 1.089465, 1.089135, 1.089330,     65, 0, 1.089710
      Data0, 0029, 736450.166667, 2017-05-01T04:00:00.000000, 1.089305, 1.089370, 1.089035, 1.089080,     74, 0, 1.089408
      

      Every printed line is still hourly, even though I would expect these lines to print out 60 times for each "hour".

      I also have feelings that something is going on behind the scenes - Oanda only allows retrieval of 500 bars. If I am replaying data, this should be limited to 500 minutes, yet I am still able to fetch 500 hours worth of data.

      What am I misunderstanding?

      posted in General Discussion
      E
      etcetc
    • RE: Oanda live data - open, close, high, low are the same

      @backtrader You're right, sorry. I will try to be more clear in the future - in the meantime, here is what I use to execute the test file, token and account id omitted.

      python oandatest.py --token XXX --account YYY --data0 EUR_USD --timeframe Minutes
      
      posted in General Discussion
      E
      etcetc
    • RE: Oanda live data - open, close, high, low are the same

      @backtrader Apologies, I removed some columns to make it more readable. Here is a snippet with the minutes timeframe and EUR_USD pair.

      ***** DATA NOTIF: LIVE
      Data0, 0501, 736474.756994, 2017-05-25T18:10:04.264837, 1.120480, 1.120480, 1.120480, 1.120480, 0, 0, 1.120612
      Data0, 0502, 736474.757386, 2017-05-25T18:10:38.183402, 1.120460, 1.120460, 1.120460, 1.120460, 0, 0, 1.120576
      Data0, 0503, 736474.757612, 2017-05-25T18:10:57.711982, 1.120430, 1.120430, 1.120430, 1.120430, 0, 0, 1.120501
      Data0, 0504, 736474.757731, 2017-05-25T18:11:07.931450, 1.120410, 1.120410, 1.120410, 1.120410, 0, 0, 1.120465
      Data0, 0505, 736474.757733, 2017-05-25T18:11:08.129286, 1.120380, 1.120380, 1.120380, 1.120380, 0, 0, 1.120432
      Data0, 0506, 736474.757785, 2017-05-25T18:11:12.594863, 1.120350, 1.120350, 1.120350, 1.120350, 0, 0, 1.120406
      Data0, 0507, 736474.757822, 2017-05-25T18:11:15.859319, 1.120330, 1.120330, 1.120330, 1.120330, 0, 0, 1.120380
      Data0, 0508, 736474.757891, 2017-05-25T18:11:21.809085, 1.120310, 1.120310, 1.120310, 1.120310, 0, 0, 1.120356
      Data0, 0509, 736474.757896, 2017-05-25T18:11:22.191853, 1.120280, 1.120280, 1.120280, 1.120280, 0, 0, 1.120330
      Data0, 0510, 736474.758029, 2017-05-25T18:11:33.672077, 1.120300, 1.120300, 1.120300, 1.120300, 0, 0, 1.120314
      Data0, 0511, 736474.758031, 2017-05-25T18:11:33.878724, 1.120330, 1.120330, 1.120330, 1.120330, 0, 0, 1.120310
      Data0, 0512, 736474.758048, 2017-05-25T18:11:35.379511, 1.120360, 1.120360, 1.120360, 1.120360, 0, 0, 1.120316
      Data0, 0513, 736474.758050, 2017-05-25T18:11:35.551216, 1.120340, 1.120340, 1.120340, 1.120340, 0, 0, 1.120322
      Data0, 0514, 736474.758057, 2017-05-25T18:11:36.164459, 1.120360, 1.120360, 1.120360, 1.120360, 0, 0, 1.120338
      Data0, 0515, 736474.758149, 2017-05-25T18:11:44.080721, 1.120390, 1.120390, 1.120390, 1.120390, 0, 0, 1.120356
      Data0, 0516, 736474.758333, 2017-05-25T18:11:59.937122, 1.120350, 1.120350, 1.120350, 1.120350, 0, 0, 1.120360

      posted in General Discussion
      E
      etcetc
    • Oanda live data - open, close, high, low are the same

      Is there something I misunderstood by using the Oanda live feed from oandatest.py?

      Data, Open, High, Low, Close
      DATA NOTIF: LIVE
      Data0, 1.120480, 1.120480, 1.120480, 1.120480
      Data0, 1.120460, 1.120460, 1.120460, 1.120460
      Data0, 1.120430, 1.120430, 1.120430, 1.120430
      Data0, 1.120410, 1.120410, 1.120410, 1.120410
      Data0, 1.120380, 1.120380, 1.120380, 1.120380
      Data0, 1.120350, 1.120350, 1.120350, 1.120350
      Data0, 1.120330, 1.120330, 1.120330, 1.120330
      Data0, 1.120310, 1.120310, 1.120310, 1.120310
      Data0, 1.120280, 1.120280, 1.120280, 1.120280
      

      This is on the minutes timeframe and each update comes around 15 seconds. Is it possible to congregate intra-minute live data such that the high, close, open, and low respect whether or not the update is still affecting the current minute? Or will I need to keep track of that myself?

      posted in General Discussion
      E
      etcetc
    • RE: Next() call not being delayed

      @backtrader Thank you, fixed.

      posted in General Discussion
      E
      etcetc
    • RE: Next() call not being delayed

      Removed for edit

      posted in General Discussion
      E
      etcetc
    • Next() call not being delayed

      I have an indicator with a period of 12 being initialized in my strategy.

      I am compressing 60 minutes into hour long bars.

      Based off of what I read on the wiki - the first next() call should not occur until 12 hours have passed in the data, correct? Yet my next() call is being triggered with only one item in self.data. Is there something I misunderstood with how compression works?

      edit: Just tried to remove compression and I still have the same issue. Here is my init function, using most of the boilerplate in oandatest.py

      I tried removing compression and this issue still occurs. Below is my strategy init function:

         def __init__(self):
          # To control operation entries
          self.orderid = list()
          self.order = None
      
          self.counttostop = 0
          self.datastatus = 0
      
          # Create SMA on 2nd data
          self.sma = bt.indicators.MovAv.SMA(self.data, period=self.p.smaperiod)
          self.atr = bt.indicators.ATR(self.data, period=20)
          self.highest = bt.indicators.MaxN(self.data, period=12)
          self.lowest = bt.indicators.MinN(self.data, period=12)
          self.margin = 0.0025
      
          print('--------------------------------------------------')
          print('Strategy Created')
          print('--------------------------------------------------')
      
      posted in General Discussion
      E
      etcetc
    • RE: Oanda Backtest

      @backtrader That was it. Thank you.

      posted in General Discussion
      E
      etcetc
    • RE: Oanda Backtest

      Sorry, another note - I have also tried using the account identifier as specified by oanda - in the form of 001-011-5838423-001

      posted in General Discussion
      E
      etcetc
    • Oanda Backtest

      I've been trying to use the oandatest.py sample but for some reason, the only output I'm able to get is a NOTSUBSCRIBED message every time. I saw that under the account flag, you are supposed to put in your account username but I have tried that and I still get the same message. My access token is correct as well and so is the name of the currency I am trying to trade under data0.

      posted in General Discussion
      E
      etcetc