我想从输出中提取数量和最后价格的值到其他变量中,但是我无法获取它们
结果如下
DEBUG:root:[{'timestamp':datetime.datetime(2018,7,24,12,23,34),'last_price':90.35,'oi_day_low':37008,'volume':23308,'sell_quantity ':6035,'last_quantity':2,'change':-0.17126125628418445,'oi':43808,'average_price':90.3275363,'ohlc':{'high':90.43,'close':90.505,'open': 90.3125,“低”:90.28}
def on_ticks(ws, ticks):
# Callback to receive ticks.
logging.debug("{}".format(ticks))
答案 0 :(得分:0)
def on_ticks(ws, ticks):
# Callback to receive ticks.
logging.debug("{}".format(ticks))
var = ticks[0]['volume']
var1 = ticks [0] ['last_price']
print(var)
print(var2)
通过使用它,它对我有用。