This repository contains code and documentation for our project in DAD course WS2021
The price data such as tick data and candle data are collected by the Price Crawler
.
Those realtime data are sent to Kafka.
There are 2 implemented news crawlers: DailyFX (dailyfx.com) and Reuters (reuters.com). The news crawler collect the latest news and sent them to Kafka.
The topics are named in the following format: {project}.{subject}.{version}
. For example: dad.candle.0
With this naming strategy,
we can adapt structural changes and migrate with less effort by incrementing the version and support multiple versions at the same time.
The spark jobs calculate the technical indicators such as Relative Strength Index (RSI), Bollinger Bands, etc. and try to predict the close price of the next candle. The predictions will be sent back to Kafka again.
This component offers the API for the frontend to access the data in MongoDB and to receive updates in realtime.
This is the frontend, where you can interact with the system and see it in action. The data are updated in realtime
- You need a FXCM Demo account. You can apply for a demo account here: https://www.fxcm.com/uk/forex-trading-demo/
- Generate a persistent token. Go to https://tradingstation.fxcm.com, login, then click on
User Account > Token Management
. - Set your token as environment variable
FXCM_TOKEN
indeployment/docker-compose.yml
In the current deployment/docker-compose.yml
there is only one active news crawler, namely the DailyFX crawler. You can also
start the Reuters crawler by using the reuters.py
file.
To spin up all services, run the following commands:
cd deployment
docker-compose up
If you already have a build of the frontend, you can serve it however you like (e.g. using a nginx container).
Otherwise, you can run the following commands to bring the frontend up in development environment:
cd services/realtime-ui
npm start
In order to run the spark job for analytics and price prediction, you need to submit them.
Here is an example of submitting a spark job for price prediction with period "m1".
Note that the --network
parameter may be differ.
cd services/sparkjobs
docker run -v $(pwd):/app \
--network=deployment_gabi \
deployment_sparkmaster /spark/bin/spark-submit \
--packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.0.1 \
--conf spark.executorEnv.frameName=m1 \
--files /app/models/EURUSD_m1.h5,/app/models/scaler_EURUSD_m1.pkl /app/price.py