def test_price(self): from pyEX import price with patch('requests.get') as mock, \ patch('pickle.dump'): mock.return_value = MagicMock() mock.return_value.status_code = 200 price('test')
def test_price(self): from pyEX import price with patch("requests.get") as mock, patch("pickle.dump"): mock.return_value = MagicMock() mock.return_value.status_code = 200 price("test")
def pyex_get_co_info(sym): #co_info = pyex.companyDF(sym) #key_stats = pyex.stockStatsDF(sym) stock_quote = pyex.quoteDF(sym) # the pyex.price() function returns a delayed price, must use pyex.last for real time # but pyex.last() returns empty when market is closed. last_price_df = pd.DataFrame({ 'symbol': [sym], 'lastprice': [pyex.price(sym)] }) last_price_df.set_index('symbol', inplace=True) #co_info = pd.concat([co_info, key_stats, stock_quote, last_price_df], axis = 1) co_info = pd.concat([stock_quote, last_price_df], axis=1) return co_info
def pyEXStockInfo(query): queryResult = pyEX.ohlc(query) currentPrice = pyEX.price(query) company = pyEX.company(query) if (queryResult.get('open').get('time') >= queryResult.get('close').get('time')): queryResult.update({'live': True}) if (queryResult.get('open').get('time') < queryResult.get('close').get('time')): queryResult.update({'live': False}) queryResult.update({'currentPrice': currentPrice}) queryResult.update({'companyDetails': company}) return queryResult
def test_price(self): from pyEX import price price(C)
def pyEXLivePrice(query): livePrice = pyEX.price(query) return livePrice