Skip to content
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

If I have an allocation table (indexed by datetime (for example: 2008-01-01), columns are the stock tickers, and the value is either 1(long)/0(no position), is it possible to translate it to P&L using the package? #146

Closed
auscott opened this issue Sep 21, 2020 · 1 comment
Labels
invalid This is not a (valid) bug report question Not a bug, but a FAQ entry

Comments

@auscott
Copy link

auscott commented Sep 21, 2020

Expected Behavior

If I have an allocation table (indexed by datetime (for example: 2008-01-01), columns are the stock tickers, and the value is either 1(long)/0(no position), is it possible to translate it to P&L using the package?

for example:
AAPL IBM
2008-01-01 1 0
2008-01-10 0 0

Actual Behavior

Steps to Reproduce

Additional info

  • Backtesting version:
@kernc
Copy link
Owner

kernc commented Sep 21, 2020

is it possible to translate it to P&L using the package?

Yes, you can add the buy/hold/sell columns as extra indicator columns to the input ohlc data. Then refer to it in Strategy.next(), either manually or through backtesting.lib.SignalStrategy.

Duplicates: #39, #64.

Hth,

@kernc kernc closed this as completed Sep 21, 2020
@kernc kernc added invalid This is not a (valid) bug report question Not a bug, but a FAQ entry labels Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This is not a (valid) bug report question Not a bug, but a FAQ entry
Projects
None yet
Development

No branches or pull requests

2 participants