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

get_historical data doesn't return correct results if there is only one row returned #7

Closed
tarunlalwani opened this issue Feb 2, 2015 · 3 comments

Comments

@tarunlalwani
Copy link
Contributor

@tarunlalwani tarunlalwani commented Feb 2, 2015

If between start date and end date there is only one result row then data is not returned correctly. Below patch to the function fixes is it all

    def get_historical(self, start_date, end_date):
        """
        Get Yahoo Finance Stock historical prices

        :param start_date: string date in format '2009-09-11'
        :param end_date: string date in format '2009-09-11'
        :return: list
        """
        hist = []
        for s, e in get_date_range(start_date, end_date):
            try:
                query = self._prepare_query(table='historicaldata', startDate=s, endDate=e)
                result = self._request(query)
                if isinstance(result, dict):
                    result = [result]
                hist.extend(result)
            except AttributeError:
                pass
        return hist
@tarunlalwani tarunlalwani changed the title get_historical data doesn't return correct results if there is only returned date get_historical data doesn't return correct results if there is only one row returned Feb 2, 2015
@lukaszbanasiak
Copy link
Owner

@lukaszbanasiak lukaszbanasiak commented Feb 17, 2015

@tarlabs Are you interested in create a pull request?

@tarunlalwani
Copy link
Contributor Author

@tarunlalwani tarunlalwani commented Feb 17, 2015

Okie, I will do that in 2-3 days time. Occupied with something else right now

@lukaszbanasiak
Copy link
Owner

@lukaszbanasiak lukaszbanasiak commented Feb 23, 2015

Fixed in PR #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.