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

Bug: Fix same-day error for portfolio historical trades. #2451

Merged

Conversation

jfarid27
Copy link
Contributor

@jfarid27 jfarid27 commented Aug 29, 2022

Description

During portfolio loading, adds last traded date in historical prices if last date isn't available. This is a very odd time dependent off by 1 error, so testing this might be difficult.

Issue

#2450

  • Summary of the change / bug fix.
  • Link # issue, if applicable.
  • Screenshot of the feature or the bug before/after fix, if applicable.
  • Relevant motivation and context.
  • List any dependencies that are required for this change.

How has this been tested?

  • Please describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • Please also list any relevant details for your test configuration.

Checklist:

Others

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • My code passes all the checks pylint, flake8, black, ... To speed up development you should run pre-commit install.
  • New and existing unit tests pass locally with my changes. You can test this locally using pytest tests/....

@DidierRLopes DidierRLopes requested review from montezdesousa and JerBouma and removed request for montezdesousa August 29, 2022 16:41
@DidierRLopes DidierRLopes added the bug Fix bug label Aug 29, 2022
Copy link
Contributor

@JerBouma JerBouma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@montezdesousa montezdesousa added do not merge Label to prevent pull request merge and removed do not merge Label to prevent pull request merge labels Aug 30, 2022
@montezdesousa montezdesousa merged commit 0ad8c95 into OpenBB-finance:main Aug 30, 2022
@montezdesousa
Copy link
Contributor

When date we are searching is larger than the max index value .searchsorted() outputs the position next to last, giving out of bounds error. Well spotted

ser = pd.Series([1, 3, 5])
ser.searchsorted(8)

Outputs index number 3, out of bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants