For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

I want to determine my position type in next (), buy or sell. What should I write?



  • I want to determine my position type in next (), buy or sell. What should I write?



  • Your question is unclear to me. Are you looking for trade position (number of units long or short), or if an order is buy sell?

    For trade position in next use:

    getposition(data=None, broker=None)
    

    For order:
    Strategy class offers three methods to assist you with orders.

    User Methods:
        isbuy(): returns bool indicating if the order buys
        issell(): returns bool indicating if the order sells
        alive(): returns bool if order is in status Partial or Accepted
    


  • @run-out
    Thanks,
    getposition(data=None, broker=None) is helpfull.


Log in to reply
 

});