def stockPrice_check(stock, check_price): stockdf = intraday.trades(apiToken="你的Token", output="dataframe", symbolId=stock) nowprice = stockdf['price'].values[-1] if nowprice > check_price: print(stock + ' 目前價格 ' + str(nowprice))
def test_intraday_trades_output_raw(): trades = intraday.trades(output="raw") assert type(trades) is list
def test_intraday_trades_output(): with raises(ValueError) as excinfo: intraday.trades(output="") assert excinfo.type is ValueError assert str(excinfo.value) == 'output must be one of ["dataframe", "raw"]'
def test_intraday_trades_output_dataframe(): trades = intraday.trades(output="dataframe") assert type(trades) is DataFrame
def test_intraday_trades(): trades = intraday.trades() assert type(trades) is DataFrame