简体   繁体   中英

How to get stock data and add it to a django model?

Hay, I am building a finance website where there is a stock model. I want the price to update automatically in a intfield when the website is running.

Read data using pandas data reader:

import pandas
import pandas_datareader as pdr
ticker = 'DAX'
start = datetime.datetime.now() - datetime.timedelta(days=30*9) # amount of days from required date
pdr.get_data_yahoo(ticker,start).to_csv('dax.csv')
dax = pandas.read_csv('dax.csv')
pandas.to_csv('sample.csv') #downloading the data

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM