<jupyter_start><jupyter_text>Prueba de Stocks_175904 - <NAME>_Fuente:<jupyter_code>from pandas_datareader import data
import matplotlib.pyplot as plt
import pandas as pd
tickers = ['AAPL', 'MSFT', '^GSPC']
start_date = '2018-09-01'
end_date = '2019-01-18'
panel_data = data.DataReader(tickers, 'yahoo', start_date, end_date)
panel_data.tail(100)
all_weekdays = pd.date_range(start=start_date, end=end_date, freq='B')
all_weekdays
close = panel_data['Adj Close'].reindex(all_weekdays)
close = close.fillna(method='ffill')
close
close.describe()
%matplotlib inline
# Get the MSFT timeseries. This now returns a Pandas Series object indexed by date.
msft = close.loc[:, 'MSFT']

# Calculate the 20 and 100 days moving averages of the closing prices
short_rolling_msft = msft.rolling(window=20).mean()
long_rolling_msft = msft.rolling(window=100).mean()

# Plot everything by leveraging the very powerful matplotlib package
fig, ax = plt.subplots(figsize=(16,9))

ax.plot(msft.index, msft, label='MSFT')
ax.plot(short_rolling_msft.index, short_rolling_msft, label='20 days rolling')
ax.plot(long_rolling_msft.index, long_rolling_msft, label='100 days rolling')

ax.set_xlabel('Date')
ax.set_ylabel('Adjusted closing price ($)')
ax.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12648221343873517, 'fraction_numerical': 0.03399209486166008, 'mean_word_length': 7.167741935483871, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '351631', 'license': 'Apache-2.0', 'n_tokens_mistral': 491, 'n_tokens_neox': 456, 'n_words': 106, 'path': 'alumnos/jorge_altamirano/stock-test.ipynb', 'repo_name': 'philwebsurfer/ITAM-QuantFinance', 'size': '1287'}