jankrepl / deepdow

Portfolio optimization with deep learning.
https://deepdow.readthedocs.io
Apache License 2.0
903 stars 138 forks source link

How does raw_to_Xy() know which column to use to calculate returns #129

Open SamKimbinyi opened 2 years ago

SamKimbinyi commented 2 years ago

The documentation says

computation of returns (if use_log then logarithmic else simple) - the first timestep is automatically deleted

How does this function know which column is the closing price and therefore which column to use to calculate returns

jankrepl commented 2 years ago

Hey there! Thank you for your interest.

It is going to compute returns (percentage change) for all the indicators (e.g. open price, close price, volume) that are in the input DataFrame.

Hope that helps.

SamKimbinyi commented 2 years ago

Thank you for the fast reply!

So if i wish to calculate portfolio returns, would you reccomend creating a dataframe that has the percentage returns from closing prices first?

jankrepl commented 2 years ago

AFAIK taking the closing prices is the most common approach - I don't really remember the rationale behind it though. However, it is really up to you:)