Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    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 live data - open, close, high, low are the same

    General Discussion
    2
    8
    2170
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      etcetc last edited by etcetc

      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?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        That's clearly not output from oandatest.py so it is impossible to say what you may have misunderstood, without being able to know what your code does.

        E 1 Reply Last reply Reply Quote 0
        • E
          etcetc @backtrader last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • B
            backtrader administrators last edited by

            See: the problem is that you say ... it is a snippet with timeframe minutes. But how you have executed the test file is not there. It is for sure obvious to you and on your system, but the others cannot know it.

            E 1 Reply Last reply Reply Quote 0
            • E
              etcetc @backtrader last edited by etcetc

              @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
              
              1 Reply Last reply Reply Quote 0
              • B
                backtrader administrators last edited by

                You are neither using --resample nor --replay and what your there see are simply the incoming ticks. The history was downloaded in minutes for sure.

                The code in oandatest.py as indicated by the name is something to test things, to play with them and that's why manual control of all switches is in place.

                E 1 Reply Last reply Reply Quote 0
                • E
                  etcetc @backtrader last edited by

                  @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?

                  1 Reply Last reply Reply Quote 0
                  • B
                    backtrader administrators last edited by

                    @etcetc said in Oanda live data - open, close, high, low are the same:

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

                    60 minutes is 1 hour and that's the backfilling before the data goes into live.

                    In any case your strategy will not be called 60 times every hour

                    • It will be called as many times as ticks are received by the system. Depending on how active the market is ... that could well be some thousand times ... until the hour is complete and the next bar starts.
                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors