<jupyter_start><jupyter_text>Load and inspect data<jupyter_code>atom_df = pd.read_csv(Path('../../resources/prices/coin_Cosmos.csv'), index_col='SNo')
atom_df
atom_df['Date'] = pd.to_datetime(atom_df['Date']).dt.date
atom_df['Date'] = pd.to_datetime(atom_df['Date'])
atom_df['Spread'] = atom_df.High - atom_df.Low
atom_df.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
Int64Index: 716 entries, 1 to 716
Data columns (total 10 columns):
 #   Column     Non-Null Count  Dtype         
---  ------     --------------  -----         
 0   Name       716 non-null    object        
 1   Symbol     716 non-null    object        
 2   Date       716 non-null    datetime64[ns]
 3   High       716 non-null    float64       
 4   Low        716 non-null    float64       
 5   Open       716 non-null    float64       
 6   Close      716 non-null    float64       
 7   Volume     716 non-null    float64       
 8   Marketcap  716 non-null    float64       
 9   Spread     716 non-null    float64       
dtypes: datetime64[ns](1), float64(7), object(2)
memory usage: 61.5+ KB<jupyter_text>Plot the closing value of Cosmos over time<jupyter_code>import matplotlib.dates as mdates

fig, ax = plt.subplots(figsize=(12,8))
# sns.lineplot(y = atom_df.Close.values, x=atom_df.Date_mpl.values, alpha=0.8, color=color[3])
sns.lineplot(y = atom_df.Close.values, x=atom_df.Date.values, alpha=0.8, color=color[3])
ax.xaxis.set_major_locator(mdates.AutoDateLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y.%m.%d'))
# fig.autofmt_xdate()
plt.xlabel('Date', fontsize=12)
plt.ylabel('Price in USD', fontsize=12)
plt.title("Closing price distribution of ATOM", fontsize=15)
plt.show()<jupyter_output><empty_output><jupyter_text>Candlestick chart<jupyter_code>import matplotlib.ticker as mticker
# from matplotlib.finance import candlestick_ohlc
import mplfinance as mpf

atom_df['Date_mpl'] = atom_df['Date'].apply(lambda x: mdates.date2num(x))

temp_atom_df = atom_df.copy(deep=False)
temp_atom_df = temp_atom_df.set_index(['Date'])
temp_atom_df = temp_atom_df.drop(['Name', 'Symbol', 'Marketcap','Spread'], axis=1)
temp_atom_df
mpf.plot(temp_atom_df.loc['2020-9-1':], type='candle', mav=(5,10), volume=True)<jupyter_output><empty_output><jupyter_text>Price prediction<jupyter_code>from fbprophet import Prophet
INPUT_FILE = "coin_Cosmos.csv"

price_predict_df = pd.read_csv("../../resources/prices/" + INPUT_FILE, parse_dates=['Date'], usecols=["Date", "Close"])
price_predict_df.columns = ["ds", "y"]
price_predict_df = price_predict_df[price_predict_df['ds']>'2020-9-1']

m = Prophet()
m.fit(price_predict_df);
future = m.make_future_dataframe(periods=7)
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
m.plot(forecast)
m.plot_components(forecast)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14835747085835393, 'fraction_numerical': 0.03885552808194984, 'mean_word_length': 4.196330275229358, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '605216', 'license': 'MIT', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1042, 'n_words': 188, 'path': 'notebooks/by_coin/cosmos_notebook_for_CVS.ipynb', 'repo_name': 'ArtTucker/crypto_prices_ML', 'size': '2831'}