Design
Main loop
Typical to most trading frameworks flumine uses an event driven design with the main thread handling these events through a FIFO queue.
- handles all events in order one by one
- runs in main
UML Diagrams
Packages
Classes
Events:
MARKET_CATALOGUEBetfair MarketCatalogue objectMARKET_BOOKBetfair MarketBook objectRAW_DATARaw streaming dataCURRENT_ORDERSBetfair CurrentOrders objectCLEARED_MARKETSBetfair ClearedMarkets objectCLEARED_ORDERSBetfair ClearedOrders object
CLOSE_MARKETflumine Close Market updateSTRATEGY_RESETflumine Strategy Reset updateCUSTOM_EVENTflumine Custom event updateTERMINATORflumine End instance update
The above events are handled in the flumine class
MarketBook Cycle
Simulation
Simulation is achieved by monkeypatching the datetime function utcnow(), this allows strategies to be simulated as if they were being executed in real time. Functions such as market.seconds_to_start and fillKill.seconds work as per a live execution.
Streams
- Single stream (market)
- As above but 'data' (flumine listener)
- Order stream
- Future work:
- Custom stream
Strategy
- Class based
- Subscribe to streams
- Single strategy subscribes to a single market stream
Handles
- Stream reconnect
- Trading client login/logout
- Trading client keep alive
- Future work:
- Execution
- place/cancel/replace/update
- controls
- fillKill
- Market Catalogue
- Polling (scores/raceCard etc)
- CurrentOrders / ClearedOrders
- database connection/logging
- Execution
notes
- market middleware (analytics/logging)
- order middleware (controls)
- paper trading
- simulation

