Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Here you can find a link for new backtrader with 3 commits !! You can post your commits in my repository - I will apply them! #472

Merged
merged 13 commits into from
Apr 16, 2023

Conversation

WISEPLAT
Copy link
Contributor

@WISEPLAT WISEPLAT commented Sep 18, 2022

By this link https://github.com/WISEPLAT/backtrader you can suggest your commits, I will apply them ASAP.
This suggestion is made here, because of no one here doesn't want to continue this cool project!

1st commit: Option to change background for plotted value tags for dark theme - to get dark theme)))
When you use dark theme you need to change background for plotted value tags.

2nd commit: Fix: In last Python versions collections.Iterable -> collections.abcIterable - to work with Python 3.11+
Please review and approve it if you have time.

**3rd commit: Fix: The set_view_interval, set_data_interval ... are removed. Now you can work with matplotlib > 3.6.x

Thanks.

@ronytesler
Copy link

How can I open an issue?

@WISEPLAT
Copy link
Contributor Author

How can I open an issue?

hi! Please write here your issue.

@ronytesler
Copy link

this is my code:

data15 = bt.feeds.GenericCSVData(dataname='BTCUSDT-15m-2022-01-01.csv',
dtformat=lambda x: datetime.utcfromtimestamp(int(x)/1000))

and this is from csvgeneric.py:

dt = datetime.strptime(dtfield, dtformat)
    else:
        dt = self._dtconvert(dtfield)

if self.p.timeframe >= TimeFrame.Days:
    # check if the expected end of session is larger than parsed
    if self._tzinput:
        dtin = self._tzinput.localize(dt)  # pytz compatible-ized
    else:
        dtin = dt

    dtnum = date2num(dtin)  # utc'ize

    dteos = datetime.combine(dt.date(), self.p.sessionend)
    dteosnum = self.date2num(dteos)  # utc'ize

    if dteosnum > dtnum:
        self.lines.datetime[0] = dteosnum

I see that for each candle, dt, dtin and dtnum are correct. dteosnum is the same all the time, and larger than dtnum, so dteosnum is the one assigned to the next candle (self.lines.datetime[0]).

So all candles get the same time.

@WISEPLAT
Copy link
Contributor Author

WISEPLAT commented Nov 30, 2022

Hi! I think you are already solved your problem))
But if you need some info, i use the following:

def next(self):
    """Приход нового бара тикера"""
    for data in self.datas:  # Пробегаемся по всем запрошенным тикерам
        if self.p.symbols == '' or data._name in self.p.symbols:  # Если торгуем все тикеры или данный тикер

            ticker = data._name
            _date = bt.num2date(data.datetime[0])

so, _date is different for tickers.

You can ask me on my youtube: https://www.youtube.com/channel/UCfxnN0xALQR6OtznIj35ypQ
in live streams... or in comment

@WISEPLAT WISEPLAT changed the title Option to change background for plotted value tags for dark theme Here you can find a link for new backtrader with 2 commits !! You can post your commits in my repository - I will apply them! Feb 22, 2023
WISEPLAT and others added 10 commits February 24, 2023 10:24
ERROR: __len__() should return >= 0 on live feed fixed
 '''      
 locator.set_view_interval(*self.axis.get_view_interval())
 locator.set_data_interval(*self.axis.get_data_interval())
'''
set_view_interval and set data_interval had been deprecated after matplotlib  3.6.x
…of Locators and Formatters (and their common base class, TickHelper) are removed. in matplotlib 3.7.0 https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.7.0.html
@WISEPLAT WISEPLAT changed the title Here you can find a link for new backtrader with 2 commits !! You can post your commits in my repository - I will apply them! Here you can find a link for new backtrader with 3 commits !! You can post your commits in my repository - I will apply them! Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants