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/

    Accessing downloaded IBData outside of Strategie-class:

    General Code/Help
    3
    6
    149
    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.
    • T
      TraderOnes last edited by

      Hello Backtrader-community,

      very happy with first experiences! great software! specially with online data-connect via IB.
      But somehow I experience restriction and cannot find solution in docu/references/community:

      Accessing IBData-download outside of Strategie-class:

      Maybe not wanted?
      Nobody needs?
      Not allowed?
      Policy-restrictions?
      InteractiveBroker recommendations?
      Design-Feature of Backtrader?

      While I am starting with Backtrader I need

      1. to check data exactly:
      2. exchange data with other application.
        Of course many ways to check data, but just want to be able to do a very simple "print(IBData)", but somehow I cannot find a way doing this outside the strategie-class.

      So many ways to access data inside-Strategie

      Maybe its possible to create an numpy-array inside strategie, while this is NOT-WANTED to be stand-alone and indepentend from other py-libs (Philosophy of Backtrader).
      But how to export np.array before or without running the strategie-class?

      Allowed to use the IBData-API as Dataprovider also for other py-projects? (f.e. tensorflow NN-training)
      Not allowed to add some indicator-values to IBData and feedforward to other analytics-software , and request an answer to integrate it in calculation of Backtrader-Strategie-class?

      1 Reply Last reply Reply Quote 0
      • T
        TraderOnes last edited by

        Loading works, adding and calculate insite Strategie also.
        How do access single entries of SampleData and f.e. print it?

        data = bt.feeds.IBData(dataname='EUR.USD-CASH-IDEALPRO', 
                host='127.0.0.1', 
                port=7496, 
                historical=True,
                #fromdate='2019-01-01',  #YYYY-MM-DD
                #todate=2020,
                #fromdate=datetime.datetime(2020, 8, 6))
                #todate=datetime.datetime(2020, 1, 1),
                #timeframe=5)
                rtbar=True)
        
        SampleData=data.close
            print('SampleData: ', SampleData)
        

        gives:
        1ad585ff-b8f4-4f4a-a54a-d3d01e4d9f59-grafik.png

        1 Reply Last reply Reply Quote 0
        • A
          ab_trader last edited by

          Docs - Cerebro - Returning the results

          • If my answer helped, hit reputation up arrow at lower right corner of the post.
          • Python Debugging With Pdb
          • New to python and bt - check this out
          1 Reply Last reply Reply Quote 0
          • T
            TraderOnes last edited by

            to be understood correctly: Access IBData

            • before execute the backtesting at all
            • even before creating cerebro

            Just after downloading (as above) at beginning of everything.

            Possible is:

                 SampleData=data.params.dataname
                 print('SampleData: ', SampleData)
            

            With the output:
            5e5dbd8f-9350-4f6b-8d6e-2cd990f3ca04-grafik.png

            But how to access the single entries?
            (I need last 20 data-points, With D1-timeframe the last 20 days)

            1 Reply Last reply Reply Quote 0
            • vladisld
              vladisld last edited by

              Data feeds in general and IBData in particular, do not load any data (historical or live) during the instantiation. IBData will issue the historical data subscription request only when its start method will be called, which in turn will be called within Cerebro engine run method.

              So, answering your question, getting the data from the data feeds before running the Cerebro run method is not possible ( at least not with current design).

              1 Reply Last reply Reply Quote 1
              • T
                TraderOnes last edited by

                Thanks alot for this important information!
                .............
                Just discussed here with friends and it came up topic with "data-quality", which is said to be expensive!
                Free-Data has only a quality of 70% !

                Is that true? What does that mean?
                This kind of statement definatelly needs exact qualification of spezific quality-aspects!
                Untrusting IB-Data feels like untrusting the Broker itself!
                Restrictions are there, but not in quality,
                https://interactivebrokers.github.io/tws-api/historical_limitations.html

                Anybody disagree?
                Anybody experienced backtesting-trouble caused by bad dataquality of OFFICIALLY(!) downloaded historical-data?
                Sound crazy and unreal.

                (Dont say,

                • you corrupted your data yourself :)
                • ok, maybe some gaps or irritations after marketclosing, when nobody should trade anyway.)
                • maybe differences in data at DealingDesk- or MarketMaker-Broker, which make their own market, and nobody should trade with them anyway.

                As this is topic far away from coding, and i can hardly find information and seems very important for Back-Trading.
                b12f7e9d-c3ad-4129-9fe6-ddee01ef57fd-grafik.png

                .....
                Just4Info: Attached some datasources, that passes my way.
                https://community.backtrader.com/topic/1118/marketstore-new-data-feed-integration
                https://www.macrotrends.net/2549/pound-dollar-exchange-rate-historical-chart
                https://openexchangerates.org/
                https://www.quandl.com/
                https://www.histdata.com/download-free-forex-data/
                https://tickstory.com/download-tickstory/
                https://intrinio.com/
                https://norgatedata.com/
                https://eikon.thomsonreuters.com/index.html
                https://live-rates.com/
                https://github.com/Live-Rates/live-rates.com
                https://github.com/stpaulchuck/Forex-Indicator-Data-Generators
                https://www.cryptodatadownload.com/data/northamerican/

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors