Giter Club home page Giter Club logo

Comments (3)

enzbus avatar enzbus commented on June 21, 2024

Hello! I'm not sure I understand, sorry. Data that is fed to the optimization routines can never have np.nan. Historical market data is managed, in this case, by UserProvidedMarketData. Its default behavior is to look at the returns dataframe and at every time step only include in the back-test (or online execution) names that have non-nan return for the period and have had non-nan returns for at least a min_history time period. The interface is defined in the MarketData base class, so if you want a different behavior you can derive from there (it only has 3 public methods). The default one defines its logic in MarketDataInMemory so you may as well redefine the one or two methods that have to do with the asset selection (I may make it easier to do in the future). MarketSimulator also has logic to decide what to do if an asset is dropped during a back-test, the default behavior is to liquidate (transform in cash) without transaction cost, assuming it's an M&A kind of situation. In general the default behavior are designed around daily trading of stocks in the US, but any other can be achieved by deriving from the default objects.

from cvxportfolio.

enzbus avatar enzbus commented on June 21, 2024

Reopening this because I need to improve docs on it.

from cvxportfolio.

enzbus avatar enzbus commented on June 21, 2024

You should post the stack trace, there are many pieces that could throw a nan error. values_in_time is the method called by all elements of a policy at each point in time of a back-test. If you're sure the error comes from the ReturnsForecast then it could be a missing or misaligned timestamp, or a missing asset. Do you have constant or varying universe?

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.