Skip to content

Commit

Permalink
few more df bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Feb 22, 2018
1 parent 0326a0b commit 59936b3
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pyEX/stocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down Expand Up @@ -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):
Expand Down
78 changes: 74 additions & 4 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 59936b3

Please sign in to comment.