You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to sell a long position at a set limit, instead of buying a short position with sell. Can anyone help?
Sample code:
def next(self):
if not self.position:
self.buy() # buys the long order
return
if self.position.is_long:
self.sell(size=self.position.size, limit=limit)
return
after the self.sell() and when reaching the next next() the self.position.is_short changes to True, which is not what I want. I would just like to buy and sell long positions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I would like to sell a long position at a set limit, instead of buying a short position with sell. Can anyone help?
Sample code:
after the self.sell() and when reaching the next next() the self.position.is_short changes to True, which is not what I want. I would just like to buy and sell long positions.
Beta Was this translation helpful? Give feedback.
All reactions