A random walk in Time Series Modeling
Andrew Carr Elastic Engineer
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821366/profile.jpeg)
About Me
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821421/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821623/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821624/pasted-from-clipboard.png)
About Me
DevOps
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821402/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821403/pasted-from-clipboard.png)
What is Time Series Analysis?
"a collection of observations of well-defined data items obtained through repeated measurements over time"
ABS:Time Series Analysis: The Basics
Etherium Modelling
Overall Approach
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821657/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821659/pasted-from-clipboard.png)
Etherium Modelling
FastAI Model
##FastAI Tabular Model
#Data Cleaning
def order(x):
if (x['Close']*1.07 < x['followDayClose']):
return 'buy'
if (x['Close'] <= x['followDayClose']):
return 'hold'
else: return 'sell'
df['followDayClose'] = df['Close'].shift(-1)
df['order'] = df.apply(order, axis=1)
#`Categorify` will transform columns that are in your `cat_names` into that type,
# along with label encoding our categorical data:
to = TabularPandas(df, cat, cat_names)
cats = to.procs.categorify
#Normalize
#To properly work with our numerical columns, we need to show a relationship between them all that our model can understand.
#This is commonly done through Normalization, where we scale the data between -1 and 1, and compute a z-score
to = TabularPandas(df, norm,cat_names=cat_names, cont_names=cont_names)
norms = to.procs.normalize
#FillMissing
fm = FillMissing(fill_strategy=FillStrategy.median)
to = TabularPandas(df, fm, cont_names=cont_names, cat_names=cat_names)
#Building DataLoader Object and loading
dls = to.dataloaders()
#Running Training
learn = tabular_learner(dls, [10000,1], metrics=accuracy)
learn.lr_find()
#Export Model
learn.export('/content/drive/MyDrive/Code/ethModel.pkl')
Etherium Modelling
FastAI Model
50.3% Accuracy
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821665/pasted-from-clipboard.png)
Etherium Modelling
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821667/pasted-from-clipboard.png)
#Import Dataset which needs to have YYYY-MM-DD date field titled 'DS' and a dependent varible titled 'Y'
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
#Instantiate a Prophet Object and call fit on the DataFrame
m = Prophet()
m.fit(df)
#Create a DataFrame with 365 days of future timestamps
future = m.make_future_dataframe(periods=365)
#Take future timestamps and apply model to predict future
forecast = m.predict(future)
fig1 = m.plot(forecast)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821674/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821675/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821677/pasted-from-clipboard.png)
Etherium Modelling
Trading bot currently running on AWS EC2 within Docker image
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821424/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821682/pasted-from-clipboard.png)
Etherium Modelling
Freqtrade
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9827921/pasted-from-clipboard.png)
Etherium Modelling
Freqtrade
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9827925/pasted-from-clipboard.png)
Etherium Modelling
Problems with tested approaches
Approach | Positives | Negatives |
---|---|---|
FastAI Tabular Model | Easy to implement. | Does not suit time series analysis case |
Facebook Prophet | Great visualization of trends. | Failed to work within Freqtrade platform. |
Freqtrade Default Strategies | Great quick start. Great interface |
Can only access cryptocurrency |
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967390/talk-Page-1.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967392/talk-Page-2.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967389/talk-Page-3.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967388/talk-Page-4.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967391/talk-Page-5.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9967387/talk-Page-6.drawio.png)
Etherium Modelling
Overall find it difficult to find an edge
Time to change market!
Future Plans
More Data and better Trained!
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821689/pasted-from-clipboard.png)
Future Plans
Utilisation of FastAI's tsai library
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821555/pasted-from-clipboard.png)
Future Plans
Modelling of Commodities
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821432/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821434/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821436/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9838727/pasted-from-clipboard.png)
Great Time Series Learning Resources
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821405/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821411/pasted-from-clipboard.png)
Python for Data Science and Machine Learning Bootcamp
FastAI: Practical Deep Learning
Great Time Series Learning Resources
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9827935/pasted-from-clipboard.png)
Time Series Forecasting in Python
Marco Peixeiro
Financial markets and software engineering: Part Time Larry (YouTube)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821419/pasted-from-clipboard.png)
Great Time Series Learning Resources
Questions?
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821691/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2181029/images/9821695/pasted-from-clipboard.png)
A Random Walk in Time Series Modelling
By Andrew Carr
A Random Walk in Time Series Modelling
- 3