Hi I've recently attempted to build a bitcoin trading bot for Coinbase exchange. At first using Actors felt natural for this sort of problem. There is asynchronous incoming and outgoing messages (exchange tick data, placing, cancelling orders), a lot of state (managing order book, following own orders), all the auxiliary tools that introduce even more state and more interactions (simulator for backtesting).
My current actor implementation involves 5-7 actors that send one another messages. Coding the system was fun and it seems to work fast enough (in simulation mode I can process 1 exchange message in 50 mics on average). But... the resulting system is not deterministic. There are many actors, significant message flow. This results in all sorts of race conditions. One of the manifestations of this problem is that the backtest results between the runs are drastically different. It almost seems like butterfly effect - one actor sends a message a tad earlier and all the subsequent order flow is totally different. I started addressing these race conditions, and after a while I realized that my system is now deterministic and... completely linear. After this I ditched Akka and reimplemented everything in conventional Scala, employing some category theory tricks. State monad in particular turned out to be quite useful. It's also worth noting that message processing time went down from 50 mics to ~10, which allows me to run backtests 5 times faster. Now my questions: is there a chance that I misunderstood and misused the actor model? Or is it the nature of my problem (trading bot) that doesn't really require such a sophisticated solution as actor model? What kind of problems can actually benefit from using actors? Is there good open source example projects to learn from? Thanks, Anton -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
