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

Question about applyPtSlOnT1 #4

Closed
ivan-vasilev opened this issue Jul 28, 2018 · 3 comments
Closed

Question about applyPtSlOnT1 #4

ivan-vasilev opened this issue Jul 28, 2018 · 3 comments

Comments

@ivan-vasilev
Copy link

In the method [3.2] applyPtSlOnT1, there is:

df0=(df0/close[loc]-1)*events_.at[loc,'side'] # path returns

This line is the same as in the book, however what is the point of multiplying the returns by the predicted side: *events_.at[loc,'side']? Wouldn't this change the sign of the returns and thus create an error when the barriers are computed on the next line? I know this is not a bug, so I'm sorry about asking here.

@Chetanbuye12
Copy link

Chetanbuye12 commented Jul 28, 2018

what is the column "side" about ?
Does it represent long as 1, short as -1 ????

Note:- loc is a timestamp !!!

@ivan-vasilev
Copy link
Author

ivan-vasilev commented Jul 28, 2018

Yes, this is my understanding. Side represents long as 1 and short as -1. The side parameter is the prediction of the first step of the algorithm. It is used in the meta-labeling part (second step). However, I don't understand why it's necessary to multiply by it when the returns are computed.

@BlackArbsCEO
Copy link
Owner

@ivan-vasilev a positive return is only beneficial if you're long. If you're short it's a negative outcome. The reverse is also true, a negative return is only beneficial if you're short. If you're long it's a negative outcome. The side is a binary variable indicating whether you are long or short.

Example:

Long positions:
+1% * 1 (side) = +1% (good)
-1% * 1 (side) = -1% (bad)

Short positions:
+1% * -1 (side) = -1% (bad)
-1% * -1 (side) = +1% (good)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants