Consolidating Rotala/Alator split
calumrussell opened this issue · comments
Tasks:
- Strategy should define the Broker it operates over rather than Broker pass up impl to Strategy (forcing use of exchange-dependent Strategy).
- Move diff from Broker to Strategy
Can do this here.
Exchanges currently have their own clock and hold the price source. The prices are never modified by the exchange so this isn't really the logical place to hold this data, and this has led to complex exchange creation logic. The clock is modified by exchange on tick, we could store this state on the exchange but the clock is produced by the source so this has (again) led to complex creation logic.
The strategy also has a clock, this is completely wrong as well. Strategy should get clock info over http/from client.
Clock also has a Vec...I don't know why but this is horrible.
Refactor Penelope significantly to remove clock. Refactor exchange to remove clock and source. Created AppState to orchestrate between components, practically this has meant more code in http. Clock may need to be removed totally.
Impl for Penelope may have performance problems because we are using range scan on BTree in order to find next date (which is passed to AppState to manage).
Mostly done but because exchanges now do not know about dates, the guarantee for no lookahead bias now lies with caller (because, in theory, callers can just pass any set of quotes to the exchange). For some reason, this test in Uist is passing -
rotala/src/exchange/uist_v1.rs
Line 782 in 3b072af
rotala/src/exchange/jura_v1.rs
Line 1230 in 3b072af