-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading currently open positions and overriding method #30
Comments
I'm not 100% clear on what you need. Could you provide some sample code
illustrating what you'd like to do?
I believe what you need can be extracted from each individual Trade object
inside the Trader. They store the strategy and the orders.
…On Su19 Jan. 2020, 9:05 pm Kaustubh Pratap Chand, ***@***.***> wrote:
Is there a way to load currently open positions preferabbly as a separate
object?
The method which loads the positions can be made overridable so if we have
multiple strategies running on one account, and say 2 strategies have
positions on asset X with quantity 10 and 20 each then we can determine
what is the position for the current strategy in asset X by subtracting the
total open position on the asset X in our account by a value we stored
locally.
The value could have been saved in the last run of our current strategy
when it received fill status.
So this way we know that even though the account has 30 shares of X, we
have to only see it as 10(30 - 20) if we are inside the second strategy.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30?email_source=notifications&email_token=ABWFQPWFLG35OMEB42A5J63Q6RM2NA5CNFSM4KIZNXL2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IHFXS7Q>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWFQPX2SCZ4ZHAB3POCB2LQ6RM2NANCNFSM4KIZNXLQ>
.
|
You may be right. I was thinking something along the lines of: https://www.backtrader.com/docu/position/ Is there a method to check the current position size in asset on the exchange? This will be useful in case whenever we restart the strategy due to computer restarting or program crashing. I tried to find something like it in the source files but couldn't. |
When live trading, ClientAccount.updateBalances() should return a This is done atuomatically and you can simply use Let me know if this helps |
Looks like it is what I was looking for. Thanks. |
Is there a way to load currently open positions preferabbly as a separate object?
The method which loads the positions can be made overridable so if we have multiple strategies running on one account, and say 2 strategies have positions on asset X with quantity 10 and 20 each then we can determine what is the position for the current strategy in asset X by subtracting the total open position on the asset X in our account by a value we stored locally.
The value could have been saved in the last run of our current strategy when it received fill status.
So this way we know that even though the account has 30 shares of X, we have to only see it as 10(30 - 20) if we are inside the second strategy.
The text was updated successfully, but these errors were encountered: