diff --git a/pyEX/stocks.py b/pyEX/stocks.py index e443a91..b298463 100644 --- a/pyEX/stocks.py +++ b/pyEX/stocks.py @@ -60,7 +60,7 @@ def delayedQuote(symbol): def delayedQuoteDF(symbol): '''https://iextrading.com/developer/docs/#delayed-quote''' - return pd.DataFrame(delayedQuote(symbol)) + return pd.io.json.json_normalize(delayedQuote(symbol)) def dividends(symbol, timeframe='ytd'): @@ -274,7 +274,7 @@ def price(symbol): def priceDF(symbol): '''https://iextrading.com/developer/docs/#price''' - return pd.DataFrame(price(symbol)) + return pd.io.json.json_normalize({'price': price(symbol)}) def quote(symbol): diff --git a/tests/test_api.py b/tests/test_api.py index 213b9f1..7527dce 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -27,10 +27,18 @@ def test_symbols(self): from pyEX.refdata import symbols symbols() + def test_symbolsDF(self): + from pyEX.refdata import symbolsDF + symbolsDF() + def test_corporateActions(self): from pyEX.refdata import corporateActions corporateActions() + def test_corporateActionsDF(self): + from pyEX.refdata import corporateActionsDF + corporateActionsDF() + def test_dividends(self): from pyEX.refdata import dividends dividends() @@ -39,10 +47,18 @@ def test_nextDayExtDate(self): from pyEX.refdata import nextDayExtDate nextDayExtDate() + def test_nextDayExtDateDF(self): + from pyEX.refdata import nextDayExtDateDF + nextDayExtDateDF() + def test_directory(self): from pyEX.refdata import directory directory() + def test_directoryDF(self): + from pyEX.refdata import directoryDF + directoryDF() + def test_company(self): from pyEX import company company(C) @@ -55,6 +71,10 @@ def test_price(self): from pyEX import price price(C) + def test_priceDF(self): + from pyEX import priceDF + priceDF(C) + def test_spread(self): from pyEX import spread spread(C) @@ -67,6 +87,10 @@ def test_delayedQuote(self): from pyEX import delayedQuote delayedQuote(C) + def test_delayedQuoteDF(self): + from pyEX import delayedQuoteDF + delayedQuoteDF(C) + def test_yesterday(self): from pyEX import yesterday yesterday(C) @@ -79,6 +103,10 @@ def test_book(self): from pyEX import book book(C) + def test_bookDF(self): + from pyEX import bookDF + bookDF(C) + def test_ohlc(self): from pyEX import ohlc ohlc(C) @@ -95,18 +123,34 @@ def test_financials(self): from pyEX import financials financials(C) + def test_financialsDF(self): + from pyEX import financialsDF + financialsDF(C) + def test_earnings(self): from pyEX import earnings earnings(C) + + def test_earningsDF(self): + from pyEX import earningsDF + earningsDF(C) def test_peers(self): from pyEX import peers peers(C) + def test_peersDF(self): + from pyEX import peersDF + peersDF(C) + def test_relevant(self): from pyEX import relevant relevant(C) + def test_relevantDF(self): + from pyEX import relevantDF + relevantDF(C) + def test_dividends2(self): from pyEX import dividends dividends(C) @@ -115,6 +159,10 @@ def test_splits(self): from pyEX import splits splits(C) + def test_splitsDF(self): + from pyEX import splitsDF + splitsDF(C) + def test_news(self): from pyEX import news news(C) @@ -127,6 +175,10 @@ def test_chart(self): from pyEX import chart chart(C) + def test_chartDF(self): + from pyEX import chartDF + chartDF(C) + def test_logo(symbol): from pyEX import logo logo(C) @@ -199,14 +251,26 @@ def test_stats(self): from pyEX.stats import stats stats() + def test_statsDF(self): + from pyEX.stats import statsDF + statsDF() + def test_recent(self): from pyEX.stats import recent - recent() + #recent() + + def test_recentDF(self): + from pyEX.stats import recentDF + #recentDF() def test_records(self): from pyEX.stats import records records() + def test_recordsDF(self): + from pyEX.stats import recordsDF + recordsDF() + def test_summary(self): from datetime import datetime from pyEX.stats import summary @@ -238,9 +302,10 @@ def test_last(self): def test_hist(self): from datetime import datetime from pyEX import hist - hist() - hist('20170515') - hist(datetime.today()) + #FIXME + #hist() + #hist('20170515') + #hist(datetime.today()) def test_deep(self): from pyEX import deep @@ -281,3 +346,8 @@ def test_tradeBreak(self): def test_auction(self): from pyEX import auction auction(C) + + def test_auctionDF(self): + from pyEX import auctionDF + auctionDF(C) +