-
Notifications
You must be signed in to change notification settings - Fork 8
Use Cases
The git repository contains example code in the example package to give users a hindsight on how the framework can be used. Two complex use cases in Live and Replay mode are presented here.
###Replay Mode with multiple traders
This example is implemented in the ReplayOrdersLoop.scala file, the source is a sequence of limit ask and bid orders as well as delete orders that were loaded in an OrderPersistor from a CSV file using the CSVFetcher class. The Replay loads these orders from the Persistor and sends them to the MarketSimulator component which manages its order books and matches orders when an execution is possible. Its output is sent to a BackLoop that saves the executed orders in a TransactionPersistor and forwards the rest to its recipients:
- A Simple Trader generates orders to increase transaction volume
- A SOBI trader uses the delta orders he receives from the BackLoop to generate orders periodically when the right conditions are met
- An instance of VWAP trader accumulates transactions and generates orders as well
- Two OHLCs of different tick size are computed from the transactions data and each one outputs to a simple moving average component
- A Double Crossover trader uses the data of both moving averages in its decision strategy and a Double Envelope trader generates orders from the data of the longer moving average.
- A RevenueCompute is also plugged on the MarketSimulator’s output and displays each trader’s performance.
In the figures, red arrows represent Order edges and blue arrows Transaction edges.

###Live Mode with Arbitrageur
The second example is implemented in the BTCArbitrage.scala file. Order and transaction data is fetched from the BTC-e and Bitstamp exchange platforms. Orders from each exchange are sent to the corresponding MarketSimulator and saved in an OrderPersistor. Transactions from the exchange as well as those generated by the MarketSimulator are sent to a BackLoop component. The BackLoops send these to an Arbitrageur that generates orders to both MarketSimulators.
