Skip to content

Commit 8ca02de

Browse files
committed
update docs
1 parent ac7a4c8 commit 8ca02de

File tree

8 files changed

+107
-13
lines changed

8 files changed

+107
-13
lines changed

docs/api.rst

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ API
44
.. toctree::
55
:maxdepth: 4
66

7-
Client
8-
------
9-
.. autoclass:: pyEX.Client
7+
client
8+
109

1110
Alternative
1211
--------------------------------
@@ -16,8 +15,7 @@ Alternative
1615

1716
Commodities
1817
--------------------------------
19-
.. automodule:: pyEX.commodities
20-
:members:
18+
.. autoclass:: pyEX.commodities.CommoditiesPoints
2119
:noindex:
2220

2321
Crypto
@@ -28,8 +26,7 @@ Crypto
2826

2927
Economic
3028
--------------------------------
31-
.. automodule:: pyEX.economic
32-
:members:
29+
.. autoclass:: pyEX.economic.EconomicPoints
3330
:noindex:
3431

3532
FX
@@ -52,8 +49,7 @@ Points
5249

5350
Rates
5451
--------------------------------
55-
.. automodule:: pyEX.rates
56-
:members:
52+
.. autoclass:: pyEX.rates.RatesPoints
5753
:noindex:
5854

5955
Reference Data

docs/client.rst

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Client
2+
====
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
.. autoclass:: pyEX.Client
8+
:noindex:
9+
:members:

pyEX/client.py

+29-2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
sar = None
113113
sma = None
114114

115+
DEFAULT_API_LIMIT = 5
116+
115117
_INCLUDE_FUNCTIONS = [
116118
# Refdata
117119
('symbols', symbols),
@@ -371,7 +373,11 @@
371373
('housing', EconomicPoints.HOUSING.value),
372374
('unemployment', EconomicPoints.UNEMPLOYMENT.value),
373375
('vehicles', EconomicPoints.VEHICLES.value),
374-
('recession_prob', EconomicPoints.RECESSION_PROB.value),
376+
('recessionProb', EconomicPoints.RECESSION_PROB.value),
377+
('initialClaims', EconomicPoints.INITIALCLAIMS.value),
378+
('institutionalMoney', EconomicPoints.INSTITUTIONALMONEY.value),
379+
('retailMoney', EconomicPoints.RETAILMONEY.value),
380+
375381
]
376382

377383
_INCLUDE_STUDIES = [
@@ -395,16 +401,20 @@ class Client(object):
395401
set version to 'sandbox' to run against the IEX sandbox
396402
api_limit (int): cache calls in this interval
397403
'''
404+
_api_limit = DEFAULT_API_LIMIT
405+
398406
def __init__(self,
399407
api_token=None,
400408
version='v1',
401-
api_limit=5):
409+
api_limit=DEFAULT_API_LIMIT):
402410
self._token = api_token or os.environ.get('IEX_TOKEN', '')
403411
if not self._token:
404412
raise PyEXception('API Token missing or not in environment (IEX_TOKEN)')
405413

406414
self._version = version
407415
self._api_limit = api_limit
416+
417+
# rebind
408418
for name, method in _INCLUDE_FUNCTIONS:
409419
setattr(self, name, wraps(method)(partial(self.bind, meth=method)))
410420
getattr(self, name).__doc__ = method.__doc__
@@ -434,3 +444,20 @@ def usage(self, type=None):
434444
raise PyEXception('type not recognized: {}'.format(type))
435445
return _getJson('account/usage/{type}'.format(type=type), self._token, self._version)
436446
return _getJson('account/usage/messages', self._token, self._version)
447+
448+
449+
#############################
450+
# for autodoc
451+
for name, method in _INCLUDE_FUNCTIONS:
452+
setattr(Client, name, method)
453+
getattr(Client, name).__doc__ = method.__doc__
454+
455+
for name, key in _INCLUDE_POINTS:
456+
p = partial(Client.bind, meth=points, key=key)
457+
p.__name__ = key
458+
setattr(Client, name, wraps(points)(p))
459+
getattr(Client, name).__doc__ = points.__doc__
460+
461+
for name, method in _INCLUDE_STUDIES:
462+
if method:
463+
setattr(Client, name, method)

pyEX/commodities.py

+16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33

44

55
class CommoditiesPoints(Enum):
6+
'''Commodities data points
7+
8+
https://iexcloud.io/docs/api/#commodities
9+
10+
Attributes:
11+
WTI; Crude oil West Texas Intermediate - in dollars per barrel, not seasonally adjusted
12+
BRENT; Crude oil Brent Europe - in dollars per barrel, not seasonally adjusted
13+
NATGAS; Henry Hub Natural Gas Spot Price - in dollars per million BTU, not seasonally adjusted
14+
HEATOIL; No. 2 Heating Oil New York Harbor - in dollars per gallon, not seasonally adjusted
15+
JET; Kerosense Type Jet Fuel US Gulf Coast - in dollars per gallon, not seasonally adjusted
16+
DIESEL; US Diesel Sales Price - in dollars per gallon, not seasonally adjusted
17+
GASREG; US Regular Conventional Gas Price - in dollars per gallon, not seasonally adjusted
18+
GASMID; US Midgrade Conventional Gas Price - in dollars per gallon, not seasonally adjusted
19+
GASPRM; US Premium Conventional Gas Price - in dollars per gallon, not seasonally adjusted
20+
PROPANE; Propane Prices Mont Belvieu Texas - in dollars per gallon, not seasonally adjusted
21+
'''
622
WTI = 'DCOILWTICO'
723
BRENT = 'DCOILBRENTEU'
824
NATGAS = 'DHHNGSP'

pyEX/economic.py

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@
33

44

55
class EconomicPoints(Enum):
6+
'''Economic data points
7+
8+
https://iexcloud.io/docs/api/#economic-data
9+
10+
Attributes:
11+
US0; US 30-Year fixed rate mortgage average
12+
US5; US 15-Year fixed rate mortgage average
13+
US; US 5/1-Year adjustable rate mortgage average
14+
FEDFUNDS; Effective federal funds rate
15+
CREDITCARD; Commercial bank credit card interest rate as a percent, not seasonally adjusted
16+
CDNJ; CD Rate Non-Jumbo less than $100,000 Money market
17+
CDJ; CD Rate Jumbo more than $100,000 Money market
18+
GDP; Real Gross Domestic Product
19+
INDPRO; Industrial Production Index
20+
CPI; Consumer Price Index All Urban Consumers
21+
PAYROLL; Total nonfarm employees in thousands of persons seasonally adjusted
22+
HOUSING; Total Housing Starts in thousands of units, seasonally adjusted annual rate
23+
UNEMPLOYMENT; Unemployment rate returned as a percent, seasonally adjusted
24+
VEHICLES; Total Vehicle Sales in millions of units
25+
RECESSION; US Recession Probabilities. Smoothed recession probabilities for the United States are obtained from a dynamic-factor markov-switching model applied to four monthly coincident variables. non-farm payroll employment, the index of industrial production, real personal income excluding transfer payments, and real manufacturing and trade sales.
26+
INITIALCLAIMS; Initial claims returned as a number, seasonally adjusted
27+
RETAILMONEY; Retail money funds returned as billions of dollars, seasonally adjusted
28+
INSTITUTIONALMONEY; Institutional money funds returned as billions of dollars, seasonally adjusted
29+
'''
30+
631
US30 = 'MORTGAGE30US'
732
US15 = 'MORTGAGE15US'
833
US5 = 'MORTGAGE5US'
@@ -18,6 +43,9 @@ class EconomicPoints(Enum):
1843
UNEMPLOYMENT = 'UNRATE'
1944
VEHICLES = 'TOTALSA'
2045
RECESSION_PROB = 'RECPROUSM156N'
46+
INITIALCLAIMS = 'IC4WSA'
47+
RETAILMONEY = 'WRMFSL'
48+
INSTITUTIONALMONEY = 'WIMFSL'
2149

2250
@staticmethod
2351
@lru_cache(1)

pyEX/rates.py

+15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33

44

55
class RatesPoints(Enum):
6+
'''Rates data points
7+
8+
https://iexcloud.io/docs/api/#treasuries
9+
10+
Attributes:
11+
THIRTY; 30 Year constant maturity rate
12+
TWENTY; 20 Year constant maturity rate
13+
TEN; 10 Year constant maturity rate
14+
FIVE; 5 Year constant maturity rate
15+
TWO; 2 Year constant maturity rate
16+
ONE; 1 Year constant maturity rate
17+
SIXMONTH; 6 Month constant maturity rate
18+
THREEMONTH; 3 Month constant maturity rate
19+
ONEMONTH; 1 Month constant maturity rate
20+
'''
621
THIRTY = 'DGS30'
722
TWENTY = 'DGS20'
823
TEN = 'DGS10'

pyEX/tests/test_economic.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ def test_all(self):
2222
c.housing()
2323
c.unemployment()
2424
c.vehicles()
25-
c.recession_prob()
25+
c.recessionProb()
26+
c.initialClaims()
27+
c.institutionalMoney()
28+
c.retailMoney()

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ universal=1
55
description_file = README.md
66

77
[flake8]
8-
max-line-length=310
8+
max-line-length=400
99
exclude=pyEX/tests/

0 commit comments

Comments
 (0)