Skip to content

Instantly share code, notes, and snippets.

@memonkey01
Created November 30, 2017 20:40
Show Gist options
  • Save memonkey01/3673b0862fbf6a726afa9fdbd58a6cda to your computer and use it in GitHub Desktop.
Save memonkey01/3673b0862fbf6a726afa9fdbd58a6cda to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
Graficando el IPC y otras acciones
Autor: Guillermo Izquierdo
Este código es para fines educativos
"""
import pandas_datareader as pdr
import matplotlib.pyplot as plt
import datetime
#Definimos una fecha de
end = datetime.datetime(2017,11,29).isoformat()
start = datetime.datetime(2017,2,1).isoformat()
print(start,end)
#Definimos nuestro indice con las fechas previas
index = '^MXX'
stock = pdr.get_data_yahoo(index, start=start, end=end)
close = stock['Close'] #Seleccionamos la columna de cierre
print(stock)
#Graficamos nuestra serie
plt.plot(close, color='b')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment