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/

    Access trade.ref

    General Discussion
    3
    3
    889
    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.
    • R
      roch_02 last edited by roch_02

      Is it possible to access trade.ref inside next() in strategy? How?

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

        If you keep a reference to the notified Trade during notify_trade you will be able to access any of its attributes.

        Per se there is no trade.ref

        Richard O'Regan 1 Reply Last reply Reply Quote 0
        • Richard O'Regan
          Richard O'Regan @backtrader last edited by Richard O'Regan

          @backtrader Hey just came across this searching for info. How do you mean 'no trade.ref' as it's in the trade object. Thanks
          e.g.

          ref:3 <-- here
          data:<backtrader.feeds.csvgeneric.GenericCSVData object at 0x1032cf438>
          tradeid:0
          size:0
          price:88.800003
          value:0.0
          commission:0.0
          pnl:3.2400050000000107
          pnlcomm:3.2400050000000107
          justopened:False
          isopen:False
          isclosed:True
          baropen:14
          dtopen:736338.0006944444
          barclose:30
          dtclose:736346.0013888889
          barlen:16
          historyon:False
          history:[]
          status:2

          You can take the man out of the army, but you can't take the army out of the man.

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