예제 #1
0
        private void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition)
        {
            MarketRunner marketRunner = GetOrAdd(new RunnerId(runnerDefinition.Id, runnerDefinition.Hc));

            //update runner
            marketRunner.OnRunnerDefinitionChange(runnerDefinition);
        }
예제 #2
0
        internal void OnRunnerDefinitionChange(RunnerDefinition runnerDefinition)
        {
            //snap is invalid
            _snap = null;

            _runnerDefinition = runnerDefinition;
        }
예제 #3
0
        public void HandleNullAdjustmentFactor()
        {
            var d = new RunnerDefinition
            {
                SelectionId = 12345,
            };

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

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

            _runner.SetDefinition(d);
            Assert.Equal(23.45, _runner.AdjustmentFactor);
        }
예제 #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);
     }
 }
예제 #7
0
 public void SetDefinition(RunnerDefinition definition)
 {
     if (definition?.SelectionId != SelectionId)
     {
         return;
     }
     if (definition.AdjustmentFactor is null)
     {
         return;
     }
     AdjustmentFactor = (double)definition.AdjustmentFactor;
 }
예제 #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);
        }
예제 #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());
        }
예제 #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());
        }
예제 #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);
        }