Skip to content

Commit

Permalink
Updated setup, readme and fixed interval location
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRPorter committed Jul 19, 2017
1 parent 98bc486 commit 688402a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ Usage
optional arguments:
end End day in form [Year,Month,Day]
interval Interval for EOD prices, valid intervals: 1d, 1wk, 1mo
Usage Examples:

.. code::
>>>from yahoo_historical import Fetcher
>>>data = Fetcher("AAPL", [2007,1,1], [2017,1,1])
>>>data = Fetcher("AAPL", [2007,1,1], [2017,1,1], interval="1d")
>>>print(data.getHistorical())
Date Open High Low Close Adj Close Volume
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
setup(
name='yahoo_historical',
packages=['yahoo_historical'],
version='0.1.2',
version='0.1.3',
description='Fetches historical EOD (end of day) prices from yahoo finance',
author='Andrew Porter',
author_email='[email protected]',
Expand Down
3 changes: 2 additions & 1 deletion yahoo_historical/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Fetcher:
api_url = "https://query1.finance.yahoo.com/v7/finance/download/%s?period1=%s&period2=%s&interval=%s&events=history&crumb=%s"
def __init__(self, ticker, start, interval = "1d", *args):
def __init__(self, ticker, start, *args, interval = "1d"):
"""Initializes class variables and formats api_url string"""
self.ticker = ticker.upper()
self.interval = interval
Expand All @@ -23,6 +23,7 @@ def __init__(self, ticker, start, interval = "1d", *args):
self.end = int(time.mktime(dt.datetime(end[0],end[1],end[2]).timetuple()))
else:
self.end = int(time.time())

self.url = self.api_url % (self.ticker, self.start, self.end, self.interval, self.crumb)

def init(self):
Expand Down

0 comments on commit 688402a

Please sign in to comment.