<jupyter_start><jupyter_text>Ricos pelo Acaso Link para o vídeo: https://youtu.be/BBomKv3NFNc  1. Importando bibliotecas<jupyter_code>import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas_datareader.data as web

!pip install yfinance --upgrade --no-cache-dir
import yfinance as yf
yf.pdr_override()<jupyter_output><empty_output><jupyter_text>Obtendo os dados do mercado<jupyter_code>ibov = web.get_data_yahoo('VALE3.SA', start='2010-05-03', end='2013-03-01')
ibov.head()
ibov.tail()
ibov["Close"].plot(figsize=(22,8), label="IBOV")
ibov["Close"].rolling(21).mean().plot(label="MM21")
ibov["Close"].rolling(200).mean().plot(label="MM200")
plt.legend()
ibov_fatiado = ibov[ibov.index.year == 2008]
ibov_fatiado["Close"].plot(figsize=(22,8), label="IBOV")
ibov_fatiado["Close"].rolling(21).mean().plot(label="MM21")
ibov_fatiado["Close"].rolling(200).mean().plot(label="MM200")
plt.legend()
ibov_fatiado = ibov[(ibov.index.year >= 2008) & (ibov.index.year <= 2015)]
ibov_fatiado["Close"].plot(figsize=(22,8), label="IBOV")
ibov_fatiado["Close"].rolling(21).mean().plot(label="MM21")
ibov_fatiado["Close"].rolling(200).mean().plot(label="MM200")
plt.legend()
ibov_fatiado = ibov[ibov.index.month == 12]
ibov_fatiado.tail(50)
ibov_fatiado = ibov[ibov.index.day == 14]
ibov_fatiado.tail(50)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1895910780669145, 'fraction_numerical': 0.05799256505576208, 'mean_word_length': 8.156462585034014, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 1, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '281315', 'license': 'MIT', 'n_tokens_mistral': 608, 'n_tokens_neox': 544, 'n_words': 76, 'path': '02_Calculando_e_Plotando_Médias_Móveis_Python_para_Investimentos_com_Google_Colab.ipynb', 'repo_name': 'alcebytes/python_para_investimentos', 'size': '1345'}