SARIMA Model For Forecasting Currency Exchange Ra 2
SARIMA Model For Forecasting Currency Exchange Ra 2
Learn More
Home Beginner
Exchange Rates
Ata Amrullah
A 20 Jun, 2023 • 7 min read
Introduction
Learning Objectives
fluctuations.
currencies.
Table of contents
GitHub.
alamat = 'https://raw.githubusercontent.co
data = pd.read_csv(alamat)
print(data.sample(11))
Data Overview
print(data.isna().sum())
Missing Value
data = data.dropna()
print(data.describe())
or the week.
trading period.
or dividends.
specific period.
analysis.
data["Date"] = pd.to_datetime(data["Date"]
data['Year'] = data['Date'].dt.year
data["Month"] = data["Date"].dt.month
print(data.head())
22003-12-1545.45000145.50000045.33200145.45500245.455002
32003-12-2245.41700045.54900045.29600145.50799945.507999 0.0
Year Month
2003 12
2003 12
2003 12
2003 12
2003 12
growth = data.groupby('Year').agg({'Close'
fig = go.Figure()
fig.add_trace(go.Bar(x=growth.index,
y=growth['Close'],
name='Yearly Growth')
fig.update_layout(title="Yearly Growth of
xaxis_title="Year",
yaxis_title="Growth (%)"
width=900,
height=600)
pio.show(fig)
import warnings
warnings.simplefilter(action='ignore', cat
# Calculate monthly growth
data['Growth'] = data.groupby(['Year', 'Mo
transform(lambda x: (x.iloc[-1] - x.iloc[0
fig = go.Figure()
fig.add_trace(go.Bar(
x=grouped_data['Month'],
y=grouped_data['Growth'],
marker_color=grouped_data['Growth'],
hovertemplate='Month: %{x}<br>Average
))
fig.update_layout(
title="Aggregated Monthly Growth of Co
xaxis_title="Month",
yaxis_title="Average Growth (%)",
width=900,
height=600
)
pio.show(fig)
result = seasonal_decompose(data["Close"],
fig = plt.figure()
fig = result.plot()
fig.set_size_inches(8, 6)
fig.show()
Seasonal Decomposition
p,d,q value
the p, d, q value.
rates.
p, d, q = 2, 1, 0
model = SARIMAX(data["Close"], order=(p, d
seasonal_order=(p, d, q, 5
fitted = model.fit()
print(fitted.summary())
model.
predictions = fitted.predict(len(data), le
print(predictions)
Prediction Values
fig = go.Figure()
fig.update_layout(
title="Training Data VS Predictions",
xaxis_title="Date",
yaxis_title="Close",
legend_title="Data",
width=1000,
height=600
)
pio.show(fig)
Conclusion
the following:
currencies.
stability.
Ata Amrullah
A 20 Jun 2023
Frequently Asked
Questions
15 68
Company Discover
About Us Blogs
Careers Podcasts
Comprehensive
Guides
Learn Engage
Contribute Enterprise
Download
App