获取python / Django中所有符号的nse股票的实时数据

问题描述 投票:0回答:1

我正在从事库存预测项目。这就是我想要的:

要显示Nifty50,Nifty100左右的所有可用股票,然后用户将选择该股票以仅预测第二天该股票的高低价格。

我正在使用Django。

[我到目前为止所做的:我可以显示库存清单。

def index(request):
    api_key = 'myAPI_Key'

    url50 = 'https://archives.nseindia.com/content/indices/ind_nifty50list.csv'
    url100 = 'https://archives.nseindia.com/content/indices/ind_nifty100list.csv'
    url200 = 'https://archives.nseindia.com/content/indices/ind_nifty200list.csv'

    sfifty = requests.get(url50).content
    shundred = requests.get(url100).content
    stwohundred = requests.get(url200).content

    nifty50 = pd.read_csv(io.StringIO(sfifty.decode('utf-8')))
    nifty100 = pd.read_csv(io.StringIO(shundred.decode('utf-8')))
    nifty200 = pd.read_csv(io.StringIO(stwohundred.decode('utf-8')))

    nifty50 = nifty50['Symbol']
    nifty100 = nifty100['Symbol']
    nifty200 = nifty200['Symbol']



    context = {
        'fifty': nifty50,
        'hundred': nifty100,
        'twohundred': nifty200
               }

    return render(request, 'StockPrediction/index.html', context)

我想要的是:我想获取所有股票的实时数据openhighLTPChangeVolume。根据实时数据,它会随着股票价值的变化而变化。

请帮助!

python django nse alphavantage alphavantage-api
1个回答
0
投票

您必须结合下面的Ajax/Jquery这样的代码来定期获取数据并更新DOM中的值:

© www.soinside.com 2019 - 2024. All rights reserved.