quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.2k stars 1.12k forks source link

question about create factors #310

Closed fzhcary closed 5 years ago

fzhcary commented 5 years ago

how do I use the last N days of closing prices to create factors? for example, using RSI to create factors that can be used in alphalens? I am talking about calculation not using quantopian's pipeline.

luca-s commented 5 years ago

Please have a look at the examples, they don't use Quantopian's Pipeline. Once you have the price data you can make use of Pandas' functionalities to compute what you need. Also make sure to read the documentation of alphalens.utils.get_clean_factor_and_forward_return to understand how to properly format the factor data.

fzhcary commented 5 years ago

Thanks a lot for your quick response! It seems that The examples create factors by simulated data. How do I create factors based on prices series for example RSI? Thanks much!

On Wed, Aug 1, 2018, 8:31 AM luca-s notifications@github.com wrote:

Please have a look at the examples https://github.com/quantopian/alphalens/tree/master/alphalens/examples, they don't use Quantopian's Pipeline. Once you have the price data you can make use of Pandas' functionalities to compute what you need. Also make sure to read the documentation of alphalens.utils.get_clean_factor_and_forward_return to understand how to properly format the factor data.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quantopian/alphalens/issues/310#issuecomment-409595714, or mute the thread https://github.com/notifications/unsubscribe-auth/AB21SLe6eqsBb8Z5mSjwWCULeC6cwvoVks5uMbvLgaJpZM4VqlSc .

luca-s commented 5 years ago

I believe you haven't looked at all the examples, some of them fetch data from yahoo or google. Unfortunately I believe their services haven't been reliable recently but I haven't tried them for quite some time. Also please keep this and future issues focused on Alphalens specific questions. Questions on how to query marked data or how to use python to compute RSI are out of topic. Thanks.

fzhcary commented 5 years ago

hi I read all the examples. Just figured out how to create factors based on daily prices. But now i have a different error within alpha lens, see below,

https://github.com/fzhcary/notebooks/blob/master/algotrade-with-quandl-api.ipynb

Do you have any idea ? I also submitted an issue to github/alphalens.

thanks a lot!

Frank

On Thu, Aug 2, 2018 at 2:17 AM, Thomas Wiecki notifications@github.com wrote:

Closed #310 https://github.com/quantopian/alphalens/issues/310.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/quantopian/alphalens/issues/310#event-1767043710, or mute the thread https://github.com/notifications/unsubscribe-auth/AB21SDBv8ruLsLrEb8lZ8ruYhs1528Zoks5uMrWPgaJpZM4VqlSc .

luca-s commented 5 years ago

@fzhcary It seems that your index is using dates in descending order. Try inverting the order.