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

questions / thoughts on examples folder #88

Open
quant5 opened this issue May 25, 2023 · 2 comments
Open

questions / thoughts on examples folder #88

quant5 opened this issue May 25, 2023 · 2 comments

Comments

@quant5
Copy link
Contributor

quant5 commented May 25, 2023

I made a PR with a small refactor to two of the examples.
#87

I have some questions / thoughts:

  • for multiperiod_tcost.py
    • why is there a hard-coded zero-out of the portfolio on 4/20/23? Should the backtester have an end_time of 4/20/23 then?
    • if you set an initial h, initial_value becomes unnecessary / overridden, it may be worth noting this in the docs
    • drawdowns are positive numbers - it's more conventional to plot them as negative (e.g., underwater). I'd actually suggest flipping the sign of the drawdowns series when it's calculated.
  • hello_world.py - I didn't refactor this as it seems really expensive for a "hello world" - making 500 yfinance calls / filling one's hard drive with data. Suggest paring down to perhaps the example in the readme?
@enzbus
Copy link
Collaborator

enzbus commented May 26, 2023

Ok you're right, I was experimenting with the examples when working on the covariance forecast, it scales nicely to hundreds of names. (The data doesn't take much space BTW, each stock takes 500k-1Mb, so less than 300Mb in total). The multiperiod example shows the effect of imposing constraints at time (if you know ahead of time that you have to be all cash on a given day, it plans and optimizes on tcost). This also showcases some new api elements (it wasn't possible in 0.0.X, now the policies in backtest are aware of the trading calendar). If you want you could also help me translate the old examples (in https://github.com/cvxgrp/cvxportfolio/tree/0.0.X ) for the new API. They should become much more terse, one of my goals has been to move logic that was built there into the library itself.

@quant5
Copy link
Contributor Author

quant5 commented May 30, 2023

Sounds great - I'll take a crack at (1) making new examples more user-friendly and explanatory and (2) refactoring old examples.

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

2 participants