Data Science Asked by Marin on January 31, 2021
I am trying to find stock data to practice with, is there a good resource for this? I found this but it only has the current year.
I already have a way of parsing the protocol, but would like to have some more data to compare with. It doesn’t have to be in the same format, as long as it has price, trades, and date statistics.
You can pull stock data very easyly in python and R (probably other languages as well) with the following packages:
In python with ystockquote
This is also a really nice tutorial in iPython which shows you how to pull the stock data and play with it
In R with quantmod
HTH.
Answered by mike1886 on January 31, 2021
There are multiple platforms (like quandl, iex, yahoo) that provide such data and pandas_datareader gives you even better interface to collect data from these platforms.
Check out this blog for a quick example.
Answered by Kyle on January 31, 2021
A lot of data providers have been disabled over time. This one still works
import datetime
import pandas as pd
import numpy as np
import pylab as pl
import datetime
from sklearn.cluster import AffinityPropagation
from sklearn import metrics
from matplotlib.collections import LineCollection
from pandas_datareader import data as wb
from sklearn import cluster, covariance, manifold
start = '2019-02-01'
end = '2020-02-01'
tickers = ['MMM',
'ABT',
'ABBV',
'ABMD',
'ACN',
'ATVI']
thelen = len(tickers)
price_data = []
for ticker in tickers:
prices = wb.DataReader(ticker, start = start, end = end, data_source='yahoo')[['Open','Adj Close']]
price_data.append(prices.assign(ticker=ticker)[['ticker', 'Open', 'Adj Close']])
#names = np.reshape(price_data, (len(price_data), 1))
names = pd.concat(price_data)
names.reset_index()
Answered by ASH on January 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP