Navigation

    Backtrader Community

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

    Posts made by konichuvak

    • RE: Commission schemes with funding fees for crypto futures

      @toinou222 instead of modifying the commission scheme you can simply increment the value of the account with every funding.

          dt = self.datetime.datetime()
      
          if not self.position.size:
              # Entry logic
              ...
          else:
              # Collect funding
              rate = self.data._dataname.loc[dt].funding
              if not np.isnan(rate):
                 funding = -self.position.size * rate
                 self.broker.add_cash(funding)
                 
             # Exit logic
             ...
      

      Here I am assuming that you are using Pandas DataFeed and there exists a funding column in it with NaNs everywhere except at 0-8-16h. You can pull the historical data using Binance's API endpoint.

      posted in Indicators/Strategies/Analyzers
      konichuvak
      konichuvak
    • Data parallel analsysis

      Anyone figured a clean way to attach individual analyzer per datafeed? The purpose is to compare performance of the strategy using build-in analyzers (return, sharpe, drawdown, etc) across multiple venues. I am aware that analyzers are meant to operate on strategies, however I was wondering whether anyone came up with a reusable pattern to write analyzers that operate on datafeeds.

      For now, I am simply running an individual backtest per datafeed in a separate process, which allows for such parallelism but introduces some overhead.

      posted in General Discussion
      konichuvak
      konichuvak
    • 1 / 1