Concurrency through Akka actors

Concurrency is achieved through utilization of the actor model using the Akka Scala library. Actors act as independent entities and can pass async messages to other actors. In this project, there are three actors: SchedulerActor, PredictionActor, and TraderActor:

  • SchedulerActor: Requests price data, stores them into DB, sends a message with prices to PredictionActor, receives an answer, and passes it to TraderActor.
  • PredictionActor: After receiving a message with prices, it predicts the next price using the best model available (this has to be chosen in application.conf; we will see the details later on). It passes a message with the prediction back to SchedulerActor, uses the rest of the modes from the model folder to make predictions on previous data, and uses the latest price to evaluate predictions. The results of such predictions are stored in the DB.
  • TraderActor: After receiving a message about prediction, using rules (which at this moment are as simple as buy if the price is predicted to grow and do nothing otherwise), this writes its decision into logs. It can send an HTTP request to a URL to trigger this decision.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset