stefan-jansen / pyfolio-reloaded

Portfolio and risk analytics in Python
https://pyfolio.ml4trading.io/
Apache License 2.0
378 stars 110 forks source link

Check if positions and transactions are empty #12

Closed zhiyisun closed 1 year ago

zhiyisun commented 2 years ago

In some cases, especially with live_start_date enabled in function create_full_tear_sheet(), there could chance that positions or transactions are empty after live_start_date. That make function get_turnover() return "IndexError: single positional indexer is out-of-bounds". That needs to be checked in function perf_stats(). Checking if positions and transactions are None is not enough. The dataframe could also be empty but not None.

image

Signed-off-by: Zhiyi Sun zhiyisun@msn.com

stefan-jansen commented 1 year ago

Addressed by #26.