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/

    Is there some ways to add and drop data dynamicly?

    General Code/Help
    3
    5
    395
    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.
    • tianjixuetu
      tianjixuetu last edited by

      Hi everyone:
      I backtest and trade futures ,because I want to backtest the real future contracts,so,now,I have to add more than 5000+ data,it lows the speed.
      can I develop a function to add data just when the future contract have real data and begin to trade?
      can I develop a function to drop data after the future contract having no data and expired?
      Is there anynone having any idea?
      Than you very much!

      type+and+object.png
      in this picture,I let the relathionship of some key classes in backtrader becoming more obvious.
      in order to speed up,add the need data and drop unnecessary data,maybe a good way!
      @backtrader

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

        you can have a look at pandafeed.py or chainer.py and implements your own datafeeds, it's very simple, especially for backtest, i think it's no more than load data in _load()

        but if you want live trading, you have to deal with disconnection and reconnection and backfill the data properly

        besides, 5000+ is not big, I am backtesting with more than 900k datas around 2min

        tianjixuetu 1 Reply Last reply Reply Quote 0
        • tianjixuetu
          tianjixuetu @Jingsi last edited by

          @Jingsi 太恐怖了,你回测90万个期货合约?吓死宝宝的节奏。你是全球期货市场的合约吗?中国的其实没那么多。
          看了一下chainer.py,还没有想到要怎么做能够加快速度。我现在5000+的数据都需要两分钟多了,能分享下你90万的回测速度怎么那么快吗?

          you can have a look at pandafeed.py or chainer.py and implements your own datafeeds, it's very simple, especially for backtest, i think it's no more than load data in _load()
          
          but if you want live trading, you have to deal with disconnection and reconnection and backfill the data properly
          

          您的这段话,我没能完全明白是什么意思,如果您用中文,可以用中文分享下吗?

          A 1 Reply Last reply Reply Quote -3
          • A
            ab_trader @tianjixuetu last edited by

            @tianjixuetu this is english speaking community even (I am more than sure) English is a second language for majority of the users here. But they are making the effort and use it. Your post shows disrespect to other users, and your answer is not useful for community. Please use English.

            • 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
            tianjixuetu 1 Reply Last reply Reply Quote 2
            • tianjixuetu
              tianjixuetu @ab_trader last edited by

              @ab_trader I don't agree your opinion,but I try my best to use english.The reason which I use chinese,maybe @Jingsi is a chinese,who can speak chinese more accurately. just as two persons who speaks english,they have a trip to Japan,when they communicate,you let them use Japanese?

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