calumrussell / rotala

Backtesting engine written in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consolidating Rotala/Alator split

calumrussell opened this issue · comments

commented

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
commented

#66 (comment)

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.

commented

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 -

fn test_that_buy_market_executes_on_next_tick() {
- and this test in Jura is failing -
fn test_that_buy_market_executes_on_next_tick() {
- these are tests to make sure that lookahead bias isn't possible, there is no reason why Uist should be passing (as it is possible for callers to cause lookahead bias, both are called on the same tick 100).