<jupyter_start><jupyter_text>Tutorials:- https://towardsdatascience.com/implementing-moving-averages-in-python-1ad28e636f9d- https://iexcloud.io/- https://pypi.org/project/iexfinance/  1. MCMC https://iexcloud.io/- create account, define environmental varirable<jupyter_code># Financial modules
from iexfinance.stocks import Stock, get_historical_data

# General python modules
import datetime

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
end = datetime.date.today()
start = end - datetime.timedelta(days=90)
df = get_historical_data('tsla',start, end, close_only=True)
df = pd.DataFrame(df).T
df['perc_change'] = df.close / df.close.shift(1)
df.head()
print(df.shape)
print(df.columns)
plt.plot(df.index, df.perc_change)
plt.show()
std = df.perc_change.std()
last = df.close[-1]
def mcmc(last,std,periods):
    
    # assumptions: normal, constant percentual short term variance and no trend
    
    space = [last]
    
    for period in range(periods):
        next_space = space[-1]*(1+np.random.normal(0,std,1))[0]
        
        if next_space < 0.01:
            space.append(0.01)
        else:
            space.append(next_space)
    
    return space[1:]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12837285363859363, 'fraction_numerical': 0.019623875715453803, 'mean_word_length': 3.78125, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '401640', 'license': 'MIT', 'n_tokens_mistral': 449, 'n_tokens_neox': 431, 'n_words': 88, 'path': 'mcmc_options.ipynb', 'repo_name': 'thewalkofdaniel/4finance', 'size': '1223'}