edtechre / pybroker

Algorithmic Trading in Python with Machine Learning
https://www.pybroker.com
Other
2.09k stars 261 forks source link

Issues in User Guide Notebooks #145

Closed FreeZIngMoon11 closed 2 months ago

FreeZIngMoon11 commented 2 months ago

Hi Ed,

I've met some issues when running the user guide notebooks. Not sure if it's because the notebooks need to be updated or my dev configuration is wrong.

  1. In "docs/source/notebooks/9. Rebalancing Positions.ipynb" and "docs/source/notebooks/10. Rotational Trading.ipynb", an attribute "adj_close" is used for ExecContext. I searched the "context.py" and found no such attribute. I guess it should be "ExecContext.close"?

  2. Also in the notebook "9. Rebalancing Positions.ipynb", in the "Riskfolio-Lib" section, the function assets_stats is called as "port.assets_stats(method_mu='hist', method_cov='hist', d=0.94)" But the funciton doesn't have the keyword "d"

Thanks for your efforts!

edtechre commented 2 months ago

Hi @FreeZIngMoon11,

I do not see any issue with adj_close. This is a custom attribute when using the YFinance data source.

It looks like the RiskFolio-Lib API changed and I have updated the notebook accordingly.

FreeZIngMoon11 commented 2 months ago

Hi Ed, Thanks for fixing the RIskFolio-Lib issue! As for the adj_close problem, I just figured out that I met this because I used AKShare to fetch Chinese Stock data instead of YFinance. And the AKShare data does not come with the adj_close attribute. So this should not be an issue.