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

Projects
None yet
2 participants
@tarunlalwani
Contributor

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 from get_historical data doesn't return correct results if there is only returned date to get_historical data doesn't return correct results if there is only one row returned Feb 2, 2015

@lukaszbanasiak

This comment has been minimized.

Show comment
Hide comment
@lukaszbanasiak

lukaszbanasiak Feb 17, 2015

Owner

@tarlabs Are you interested in create a pull request?

Owner

lukaszbanasiak commented Feb 17, 2015

@tarlabs Are you interested in create a pull request?

@tarunlalwani

This comment has been minimized.

Show comment
Hide comment
@tarunlalwani

tarunlalwani Feb 17, 2015

Contributor

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

Contributor

tarunlalwani commented Feb 17, 2015

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

@lukaszbanasiak

This comment has been minimized.

Show comment
Hide comment
@lukaszbanasiak

lukaszbanasiak Feb 23, 2015

Owner

Fixed in PR #12

Owner

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