Git Product home page Git Product logo

Comments (10)

edtechre avatar edtechre commented on July 17, 2024 1

Hi @Pirat83,

Thank you for pointing this out. Yes, I can add an option that allows between_time to be a tuple of time objects so that timezone information is preserved.

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Hi @Pirat83,

Sorry for the delay. I am looking at this now.

I am not able to reproduce the issue you are having. Could you provide sample code here? Also, which OS and version of Pandas are you using? I noticed that timezone conversion seems to work differently on Windows in Pandas.

FWIW, the between_time parameter ends up using Panda's between_time method to filter dates.

from pybroker.

Pirat83 avatar Pirat83 commented on July 17, 2024

Hi @edtechre, I am using Linux and Pandas < 2.0.0. So I think it is the latest 1.x.y version.

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Thank you @Pirat83. That is the same as my setup. Can you provide me with sample code?

from pybroker.

Pirat83 avatar Pirat83 commented on July 17, 2024

Hi @edtechre, Yes of course.

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Hi @Pirat83,

Let me know if this is still an issue.

from pybroker.

Pirat83 avatar Pirat83 commented on July 17, 2024

Oh sorry. I will provide the code this week or close the ticket.

from pybroker.

Pirat83 avatar Pirat83 commented on July 17, 2024

Hi @edtechre - I have added some example code to https://github.com/Pirat83/pybroker-experiments/tree/issue-69-and-51

from pybroker.

Pirat83 avatar Pirat83 commented on July 17, 2024

So one of the main challenges is that pybroker dropps the timezone and then continues working with datetime without timezones.

datetimes are still in the US/Eastern timezone even if the timezone is not present any more. If someone want's to filter for some candles then ´datetime´s need to be used without timezone but they must match the US/Eastern timezone.

Since:

        result: TestResult = self.backtest(
            self.start_date_time, self.end_date_time, self.time_frame, ('9:30', '16:00'),
            [Day.MON, Day.TUES, Day.WEDS, Day.THURS, Day.FRI]
        )

can not be used if start_date_time and end_date_time additional filtering needs to be introduded in _weitght and _execute like this:

        result: TestResult = self.backtest(
            timeframe=self.time_frame, between_time=('9:30', '16:00'),
            days=[Day.MON, Day.TUES, Day.WEDS, Day.THURS, Day.FRI]
        )

Please correct me if I am wrong. Thank you very much or did not understand somehting correctly.

Thank you very much for your time and work.

from pybroker.

edtechre avatar edtechre commented on July 17, 2024

Hi @Pirat83,

Sorry for the late response. The timezone information is dropped in order to support filtering backtest data by the start/end date arguments, because those are datetime objects without timezone information. This happens independently of filtering with between_time.

Note, filtering with between_time uses Pandas' between_time filtering.

I would suggest performing any filtering on your DataFrame before executing your backtest on it. This can be done by querying your DataSource for the DataFrame, and then passing the modified DataFrame as your DataSource to the Strategy. See this notebook for an example.

If that is not enough, then I suggest assuming that you are dealing with times that have been normalized to US/Eastern, as you mentioned.

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.