我正在尝试编写一个Python程序来获取国家证券交易所的实时股票/股票价格。为此,我使用了NSETOOLS API。下面是我的代码:
from nsetools import Nse
info = nse.get_quote('RELIANCE')
print(info)
print("Last Traded Price: ", info["lastPrice"])但我不会实时获得股票的最新交易价格。
请帮帮我。
我的目标是: 1)实时获取股票的最新交易价格
发布于 2020-08-26 20:10:05
将while循环与time.sleep(秒)一起使用同样,您必须定义nse,使用以下命令:nse = Nse()
from nsetools import Nse
import time
nse = Nse()
info = nse.get_quote('RELIANCE')
i = 1
while i == 1:
print(info)
print("Last Traded Price: ", info["lastPrice"])
time.sleep(5)https://stackoverflow.com/questions/61655286
复制相似问题