Predicting Lira Price Through Twitter Data Analysis

Michael Tawk

Data Scientist
ML Engineer
Python
TensorFlow

Objective

The objective of this project is to predict the exchange rate of the Lebanese Lira based on the tweets of the previous day. During the years 2019-2021 tweets played a big role in defining the exchange rate; negative tweets more often than not caused the Lebanese Lira to drop, while positive tweets caused it to rise. The scope of this project was one year back.

Methodology

The dataset for the Lira price (containing the date and the price versus the US dollar) was found online. The tweets of the previous year for the Middle East region were also collected and stored as text with the date of each tweets. Only tweets in English were kept, tweets in other languages (Arabic, French) were discarded. Then the tweets were embedded using BERT and then fed into a SVR model that was developed and tuned. Different models were tested until a satisfying Mean Square Error (MSE) was reached.
Lira price variation function of months
Lira price variation function of months

Results

The plot below represents the difference between the predicted and actual values of the Lebanese Lira rate based on the best model performed which is SVR with embedding. It is clear that the model was able to capture the trend of fluctuations.
Variation of predicted and actual Lebanese Lira rate function of days
Variation of predicted and actual Lebanese Lira rate function of days
In addition to MSE we evaluated the model using R2 Score, the model achieved a MSE of 0.0373 and R2 Score of 0.317.
Partner With Michael
View Services

More Projects by Michael