コード例 #1
0
    def test_TOPS_json_syms(self):
        ls = get_market_tops("AAPL")
        ls2 = get_market_tops(["AAPL", "TSLA"])

        assert isinstance(ls, list)
        assert isinstance(ls2, list)
        assert len(ls) == 1
        assert len(ls2) == 2
コード例 #2
0
ファイル: main_test_iex.py プロジェクト: hukf/test
allkeys['chart'] = chart
io.savemat('result.mat', {'tsPY': allkeys})

# Historical Data

start = datetime(2013, 11, 13)
#end = datetime(2017, 5, 24)
end = datetime.today()
df = get_historical_data('MMM', start=start, end=end, output_format='pandas')
df['date'] = df.index
#df.drop(['date'],axis=1)
df.reset_index(level=0, inplace=True)
scipy.io.savemat('test.mat', {'struct': df.to_dict('list')})

#IES Market Data
a = get_market_tops('TSLA', output_format='pandas')
get_market_last()
get_market_deep()
get_market_book()
# IEX stats
get_stats_intraday()
get_stats_recent()[0]
get_stats_records()
get_stats_daily(last=3)
get_stats_monthly(start=datetime(2017, 2, 9), end=datetime(2017, 5, 24))[0]

b = get_stats_intraday('TSLA')

tsla = Stock(['TSLA', 'AAPL'], output_format='pandas')
tsla.get_open()
tsla.get_price()
コード例 #3
0
ファイル: test_market.py プロジェクト: stubs/iexfinance
    def test_TOPS_pandas(self):
        df = get_market_tops("AAPL", output_format='pandas')
        df2 = get_market_tops(["AAPL", "TSLA"], output_format='pandas')

        assert isinstance(df, DataFrame)
        assert isinstance(df2, DataFrame)
コード例 #4
0
ファイル: test_market.py プロジェクト: stubs/iexfinance
 def test_TOPS_too_many_symbols(self):
     with pytest.raises(ValueError):
         get_market_tops(self.bad)
コード例 #5
0
ファイル: test_market.py プロジェクト: stubs/iexfinance
    def test_TOPS_json_default(self):
        ls = get_market_tops()

        assert isinstance(ls, list) and len(ls) > 7500
コード例 #6
0
        break
    elif stock in ['Version', 'VERSION', 'version']:
        print('Py-Stock Version:', version)
        print('\nEnter a stock symbol:')
        continue
    else:
        csv_file = csv.reader(open('symbols2.csv', 'r'), delimiter=',')

        for row in csv_file:
            if row[0].startswith(stock) and row[0].endswith(
                    stock
            ):  # checking stocks who's symbol is inside other symbols
                print('\nCorporation Name:', row[1])
                print('Sector:', row[2])
                print('Industry:', row[3])
        stocks_all_info = get_market_tops(stock)
        stocks_all_info_unpack = stocks_all_info[
            0]  # have to unpack the {} from inside the []
        print('Stock Symbol:', stocks_all_info_unpack['symbol'])
        print('\nLast Sale Price: $' +
              str(stocks_all_info_unpack['lastSalePrice']))
        print('Last Sale Size: ' + str(stocks_all_info_unpack['lastSaleSize']))
        print('Market Percent for ' + stocks_all_info_unpack['symbol'] + ': ' +
              str(stocks_all_info_unpack['marketPercent']) + '%')
        print('Market Volume for ' + stocks_all_info_unpack['symbol'] + ': ' +
              str(stocks_all_info_unpack['volume']))
        print('\n')
        print(
            'Is there any other stock I can look up for you? If no, simply type \"no\"'
        )