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

Examine get_backtest() format and make quantrisk compat #6

Closed
twiecki opened this issue Jun 8, 2015 · 8 comments
Closed

Examine get_backtest() format and make quantrisk compat #6

twiecki opened this issue Jun 8, 2015 · 8 comments
Assignees
Milestone

Comments

@twiecki
Copy link
Contributor

twiecki commented Jun 8, 2015

get_backtest() on the quantopian research platform (QRP) returns backtest results, positions and transactions. For quantrisk to be useful on the QRP, it has to work with that format.

I imagine this could go 2 ways. Either we switch internally to always use that format if it's convenient, or we transform whatever get_backtest() returns.

@twiecki twiecki self-assigned this Jun 8, 2015
@twiecki
Copy link
Contributor Author

twiecki commented Jun 15, 2015

The relevant inputs we currently need are:

  • daily returns
  • positions
  • transactions

get_backtest() returns an object that is a simple collection of DataFrames that contain the relevant information. Returns are very easy to get and have the same format we require.

There is one major difference between the formats used for positions and transactions. While we have one index dt per day for positions and then store the positions as a dict, this uses duplicated daily dts as an index, one for each position. The format in QRP is probably better to work with in the long term so I propose we switch internally to use the prior format established by @ssanderson.

@twiecki
Copy link
Contributor Author

twiecki commented Jun 29, 2015

@ssanderson Can you point me to the code where you are building up these data structures? Do you think it's a good idea to borrow that same code here?

@twiecki
Copy link
Contributor Author

twiecki commented Jun 29, 2015

From @ssanderson: "qexec/research/backtest.py, in the constructor of the BacktestResult class" https://github.com/quantopian/qexec/blob/master/qexec/research/backtest.py#L424

@twiecki twiecki added this to the Public beta milestone Jun 29, 2015
@justinlent
Copy link
Contributor

@ssanderson @twiecki do either of you know whether the result from get_backtest() contains an attribute that might contain the date which the algo started live zipline papertrading (if it has)? This could easily allow us to compute both in-sample and out-of-sample stats for algos that both have a backtest+papertrading

@twiecki
Copy link
Contributor Author

twiecki commented Jun 30, 2015

Good point, we'd definitely need that, I don't know the answer though. Maybe a backtest and live algo are different entities for research? So we'd have to stitch them together manually.

@ssanderson
Copy link
Contributor

@justinlent @twiecki the BacktestResult object has start_date and end_date attributes, which should have the correct values for both backtesting and live results.

Note that Q research doesn't currently support accessing live algo results at all. There's a PR from @seongsean that implemented the functionality here: https://github.com/quantopian/qexec/pull/5252. At the time, it was sidelined due to security concerns because we didn't have user_id validation.

@twiecki twiecki closed this as completed in c1a8a52 Jul 9, 2015
twiecki added a commit that referenced this issue Jul 9, 2015
twiecki added a commit that referenced this issue Jul 9, 2015
twiecki added a commit that referenced this issue Jul 9, 2015
@gusgordon
Copy link
Contributor

I believe this does not fully support minute backtest results.

@gusgordon gusgordon reopened this Jul 10, 2015
@gusgordon gusgordon modified the milestones: 0.1 release, Public beta Jul 10, 2015
@twiecki
Copy link
Contributor Author

twiecki commented Jul 13, 2015

I checked and I think it should. The positions are daily to begin with and the transaction code also aggregates over full days.

@twiecki twiecki closed this as completed Jul 13, 2015
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

4 participants