Git Product home page Git Product logo

Comments (6)

edtechre avatar edtechre commented on July 17, 2024

Thank you for your question, snexus.

In PyBroker, the execution function is called separately for each symbol, and only when there are bars of data available. If there is no data available on a date, the execution function will not run for that missing bar.

Regarding your scenario, if you had bought a symbol in 2015, and there is no data available for that symbol in 2016, and you did not sell the symbol before it was delisted, then the position will still be held in your portfolio at the close price of the last available bar of data.

It would be difficult to determine what action to take when data ends, as PyBroker does not assume that the timestamps of bars for multiple symbols need to all be the same. It is not clear when to raise an error condition after a certain amount of time elapses between bars of different symbols. But I am open to suggestions on how to handle this situation differently.

One thought that comes to mind would be to add a configuration option that, when enabled, automatically liquidates any held position on the last bar of available data at market price, specified with PriceType.

from pybroker.

snexus avatar snexus commented on July 17, 2024

An ability to liquidate any held position would be great!

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Great, I will work on adding this now, and update this ticket once committed.

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Added exit_on_last_bar option with 8f89571

This will be in release v1.0.21

from pybroker.

snexus avatar snexus commented on July 17, 2024

Thanks for that!

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Added in v1.0.21

from pybroker.

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.