Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how to sell a long order position at limit price, instead of opening a short order #1097

Unanswered
Marinades asked this question in Q&A
Discussion options

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.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /