i want to set buy limit orders and sell limit orders at the same time , but the sell orders can only be used to reduce or close positions , do not open short position, how to fullfill? #1049
if self.position.size >= self.initial_position:
for i in greater_than_target:
if i == greater_than_target[0]:
self.sell(size=-self.initial_position, limit=i)
else:
self.sell(size=int(-self.initial_position*self.ratio), limit=i)
elif 0 < self.position < self.initial_position:
for i in greater_than_target:
self.sell(size=int(-self.initial_position * self.ratio), limit=i)
only using the sell limit order to reduce or colse positions, do not open short positions, how to do ?
only using the sell limit order to reduce or colse positions, do not open short positions, how to do ?