Exemplo n.º 1
0
        private void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition)
        {
            MarketRunner marketRunner = GetOrAdd(new RunnerId(runnerDefinition.Id, runnerDefinition.Hc));

            //update runner
            marketRunner.OnRunnerDefinitionChange(runnerDefinition);
        }
Exemplo n.º 2
0
        internal void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition)
        {
            //snap is invalid
            _snap = null;

            _runnerDefinition = runnerDefinition;
        }
Exemplo n.º 3
0
        public void HandleNullAdjustmentFactor()
        {
            var d = new RunnerDefinition
            {
                SelectionId = 12345,
            };

            _runner.SetDefinition(d);
            Assert.Equal(0, _runner.AdjustmentFactor);
        }
Exemplo n.º 4
0
        public void DoNotSetAdjustmentFactorIfWrongRunner()
        {
            var d = new RunnerDefinition
            {
                SelectionId      = 2,
                AdjustmentFactor = 23.45,
            };

            _runner.SetDefinition(d);
            Assert.Equal(0, _runner.AdjustmentFactor);
        }
Exemplo n.º 5
0
        public void SetAdjustmentFactorOnRunnerDefinition()
        {
            var d = new RunnerDefinition
            {
                SelectionId      = 12345,
                AdjustmentFactor = 23.45,
            };

            _runner.SetDefinition(d);
            Assert.Equal(23.45, _runner.AdjustmentFactor);
        }
Exemplo n.º 6
0
 private void ProcessRunnerDefinition(RunnerDefinition runner)
 {
     if (runner.SelectionId is null)
     {
         return;
     }
     if (Runners.ContainsKey((long)runner.SelectionId))
     {
         Runners[(long)runner.SelectionId].SetDefinition(runner);
     }
 }
Exemplo n.º 7
0
 public void SetDefinition(RunnerDefinition definition)
 {
     if (definition?.SelectionId != SelectionId)
     {
         return;
     }
     if (definition.AdjustmentFactor is null)
     {
         return;
     }
     AdjustmentFactor = (double)definition.AdjustmentFactor;
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 10
0
        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());
        }
Exemplo n.º 11
0
        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);
        }