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

Various improvements around dividend handling #433

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

szotsaki
Copy link

There are various issues when fastquant is used with current Yahoo Finance source (try with S&P500: ^GSPC). I aimed to fix them with these commits.

It's not supported and causes various issues like:

pandas.errors.MergeError: Not allowed to merge between different levels.
(2 levels on the left, 1 on the right)
The master DF doesn't contain TZ information either but its presence in
dividends DF prevents the two being merged together.

Error:
ValueError: You are trying to merge on datetime64[ns] and datetime64[ns,
America/New_York] columns for key 'Date'. If you wish to proceed you
should use pd.concat
"self.datadiv" is a list of dividends for each tick. Adding the whole
list of dividends on each processing step is erroneous and also causes
various other issues.

Error in backtrader/analyzers/drawdown.py", line 93, in notify_fund:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
Instead of retrying with other exchanges (where the list seems
arbitrary).
Previously, only the first transaction was protected by a stop-loss or
trailing stop-loss. It also didn't allow for parallel (trailing) stop
orders.
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.

1 participant