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/

    Extending transactions object from Analyzer

    Indicators/Strategies/Analyzers
    3
    3
    80
    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.
    • Pablo Reyes Almagro
      Pablo Reyes Almagro last edited by

      Hi,

      I'm running my strategy and doing some analysis on it with Pyfolio. One of the things I would like to be able to know is what was the condition that triggered a buy/sell operation. I know I could probably show this in a log, but I'd prefer to store it somewhere in memory that's later available in an Analyzer.

      At the moment I'm accessing the strategy transactions with:

      returns, positions, transactions, gross_lev = pyfoliozer.get_pf_items()
      

      What would be the best way to fill (I guess from the Strategy? extending the Analyzer?) more data into the transactions object? Like a new field called "Condition" or maybe some indicator value? I'm sure there may be a cleaner way to obtains this data, but I would prefer not to over-complicate it for now. In any case, I'm all ears.

      Thanks

      1 Reply Last reply Reply Quote 1
      • run-out
        run-out last edited by

        Trade List created by @ab_trader is an excellent example of custom creating an analyzer.

        1 Reply Last reply Reply Quote 0
        • Paul Langer
          Paul Langer last edited by

          Hi Pablo,

          may I ask how you actually managed to run pyfolio? I was trying to run the sample code from the Documentation and got the error

          TypeError: create_full_tear_sheet() got an unexpected keyword argument 'gross_lev'

          which seems to be known. Did you downgrade you pyfolio version? Would be awesome I could get a version to run :)

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }