Code Monkey home page Code Monkey logo

Comments (5)

enzbus avatar enzbus commented on June 29, 2024 1

You're looking for the execute method of a policy object, I think. Let me know if it works for you, you need to instantiate a market data object for it, in a similar way of a market simulator.

You're right on the way the back-test result is formatted. In the future it will be possible to continue a back-test from the end, at the last timestamp you have the weights but not w_plus.

from cvxportfolio.

enzbus avatar enzbus commented on June 29, 2024

PS I added a new option to cvx.DownloadedMarketData and cvx.UserProvidedMarketData, do_asset_selection, which is better set to False for online usage. This is only in the repository version at this point, and I'm testing it with examples/strategies/dow30_daily.py, running it every day at market open New York time. It will take some days to make it to a pip release.

from cvxportfolio.

pcgm-team avatar pcgm-team commented on June 29, 2024

Another question about execute and online usage (and looking at your example dow30_daily).

cvx.UserProvidedMarketData (or in your case cvx.DownloadedMarketData) tends to be using open prices. But if you are online isn't the most recent price going to be close? Because you don't have the bar full bar yet to use open. do the 'price' df have one extra row than the volume and returns dfs passed into cvx.UserProvidedMarketData?

from cvxportfolio.

enzbus avatar enzbus commented on June 29, 2024

You only need past returns (open prices are used by execute to give number of shares to trade, optionally). Past returns are passed down to all elements of a policy (covariance estimators, ...) to make their forecasts. If you don't know the most recent past return it's not necessarily a big deal. For online execution, though, you should know the most recent one to get the dollar holdings you have at time t. As you correctly say, Yahoo Finance doesn't provide accurate open prices a few minutes after market open. If I find another free source to use for that I'd switch, but for now I'm using the Yahoo Finance ones and then, next day, recompute the holdings for the past day. You can see it done in the commits, some names get a little adjustment. This is not part of the main library, it's logic specific for the examples strategies that are run online. I'll maybe work on making it smarter, but if you have paid data sources that give you more accurate prices you should probably use them. The example strategies do the best I can with free data.

from cvxportfolio.

pcgm-team avatar pcgm-team commented on June 29, 2024

That clarifies, thanks.

from cvxportfolio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.