Skip to content

Latest commit

 

History

History
166 lines (137 loc) · 2.87 KB

README.md

File metadata and controls

166 lines (137 loc) · 2.87 KB

Simple IEX Stock Fetcher

A python lib to get stock prices/dividends/splits from IEX Cloud.

My IEX Referrals: https://iexcloud.io/s/62efba08

Test api

import iex
import key
iex.init(key.test_token, api='sandbox')
aapl = iex.Stock('AAPL')
aapl.chart('5d', chartCloseOnly=True)
change changeOverTime changePercent close volume
date
2019-10-01 0.630000 0.002846 0.2776 235.08 36626895
2019-10-02 -5.740000 -0.023081 -2.5109 222.51 35941685
2019-10-03 1.940000 -0.014185 0.8914 231.78 30438546
2019-10-04 6.310000 0.013995 2.8347 230.24 34995248
2019-10-07 0.051249 0.000000 0.0200 234.46 32130948
aapl.dividends('1y')
amount currency date declaredDate description flag frequency paymentDate recordDate
exDate
2018-11-14 0.74 USD 2019-10-08 2018-11-10 er eD lrpfpl$esAa7reP a udDiv. h3 areSeeydicr ... QhneQoNCao g reayurltQ 2018-11-29 2018-11-14

Fetcher stocks

symbols = iex.Reference.symbols()
symbols = symbols[(symbols.type == 'ad') | (symbols.type == 'cs') & (symbols.exchange != 'OTC')]
symbols = symbols.symbol.values
from tqdm.notebook import tqdm
for k in tqdm(symbols):
    sys.stdout.write('\r{}   '.format(k))
    filename = "./daily/{}.csv".format(k)
    iex.Stock(k).chart('5y').to_csv(filename)
print('ok')

Code above will consume about 60 million messages