private void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition) { MarketRunner marketRunner = GetOrAdd(new RunnerId(runnerDefinition.Id, runnerDefinition.Hc)); //update runner marketRunner.OnRunnerDefinitionChange(runnerDefinition); }
internal void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition) { //snap is invalid _snap = null; _runnerDefinition = runnerDefinition; }
public void HandleNullAdjustmentFactor() { var d = new RunnerDefinition { SelectionId = 12345, }; _runner.SetDefinition(d); Assert.Equal(0, _runner.AdjustmentFactor); }
public void DoNotSetAdjustmentFactorIfWrongRunner() { var d = new RunnerDefinition { SelectionId = 2, AdjustmentFactor = 23.45, }; _runner.SetDefinition(d); Assert.Equal(0, _runner.AdjustmentFactor); }
public void SetAdjustmentFactorOnRunnerDefinition() { var d = new RunnerDefinition { SelectionId = 12345, AdjustmentFactor = 23.45, }; _runner.SetDefinition(d); Assert.Equal(23.45, _runner.AdjustmentFactor); }
private void ProcessRunnerDefinition(RunnerDefinition runner) { if (runner.SelectionId is null) { return; } if (Runners.ContainsKey((long)runner.SelectionId)) { Runners[(long)runner.SelectionId].SetDefinition(runner); } }
public void SetDefinition(RunnerDefinition definition) { if (definition?.SelectionId != SelectionId) { return; } if (definition.AdjustmentFactor is null) { return; } AdjustmentFactor = (double)definition.AdjustmentFactor; }
public void SetAdjustmentFactorToZeroIfNull() { var rc = new RunnerChangeStub() .WithSelectionId(1).WithBestAvailableToLay(1, 2.5, 100); _runner.OnRunnerChange(rc, 0); var d = new RunnerDefinition { SelectionId = 1, }; _runner.SetDefinition(d); Assert.Equal(0, _runner.AdjustmentFactor); }
public void HandleNullSelectionIdInRunnerDefinition() { var rd = new RunnerDefinition { AdjustmentFactor = 54.32 }; var md = new MarketDefinition { Runners = new List <RunnerDefinition> { rd }, }; var mc = new MarketChangeStub().WithMarketDefinition(md); _market.OnChange(_change.WithMarketChange(mc).Build()); }
public void HandleRunnerDefinitionForRunnerThatDoesNotExist() { var rc = new RunnerChangeStub(); var rd = new RunnerDefinition { SelectionId = 1, AdjustmentFactor = 54.32, }; var md = new MarketDefinition { Runners = new List <RunnerDefinition> { rd }, }; var mc = new MarketChangeStub() .WithMarketDefinition(md) .WithRunnerChange(rc); _market.OnChange(_change.WithMarketChange(mc).Build()); }
public void OnMarketDefinitionAdjustmentFactorIsSet() { var rc = new RunnerChangeStub(); var rd = new RunnerDefinition { SelectionId = 12345, AdjustmentFactor = 54.32, }; var md = new MarketDefinition { Runners = new List <RunnerDefinition> { rd }, }; var mc = new MarketChangeStub() .WithMarketDefinition(md).WithRunnerChange(rc); _market.OnChange(_change.WithMarketChange(mc).Build()); Assert.Equal(54.32, _market.Runners[12345].AdjustmentFactor); }