Code Monkey home page Code Monkey logo

Comments (4)

Marigold avatar Marigold commented on June 23, 2024

Hey, this is solely a research project, it's not meant to run in "production". For that, you'll need to connect to a broker (like IB or something, there are tons of packages that can help you with that). OLMAR is such a simple algorithm that once you understand it, you can integrate it into your production code in like ~50 lines.

from universal-portfolios.

DrPaprikaa avatar DrPaprikaa commented on June 23, 2024

Thanks for the quick reply. I already have a production algo and I have been researching strategies for a while now.
I recently came across online portfolio selection algorithms and your repo specifically. I would like to understand how your code works and how I can input it in my personnal backtester, and ultimatly run it live.

from universal-portfolios.

Marigold avatar Marigold commented on June 23, 2024

Understanding it is pretty easy, for instance OLMAR has just 70 lines. The step method returns portfolio weights for every time step from available inputs (last portfolio weights and historical prices). That's pretty easy to copy into any backtester.

from universal-portfolios.

DrPaprikaa avatar DrPaprikaa commented on June 23, 2024

Thank you for your answer.

Btw, I get the error, in OLMAR's update() :

RuntimeWarning: divide by zero encountered in double_scalars
  lam = max(0., (eps - np.dot(b, x)) / np.linalg.norm(x - x_mean)**2)

which is due to x = [1, 1, ..., 1] at the first step, therefore x-x_mean = 0 and np.linalg.norm(x - x_mean)**2 = 0, therefore the division by zero (at the first step only, the code works fine after that).

Would you know a workaround ?

Thanks !

from universal-portfolios.

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.