Esempio n. 1
0
        internal void OnPriceChange(bool isImage, RunnerChange runnerChange)
        {
            //snap is invalid
            _snap = null;

            MarketRunnerPrices newPrices = new MarketRunnerPrices();


            newPrices.AvailableToLay    = _atlPrices.OnPriceChange(isImage, runnerChange.Atl);
            newPrices.AvailableToBack   = _atbPrices.OnPriceChange(isImage, runnerChange.Atb);
            newPrices.Traded            = _trdPrices.OnPriceChange(isImage, runnerChange.Trd);
            newPrices.StartingPriceBack = _spbPrices.OnPriceChange(isImage, runnerChange.Spb);
            newPrices.StartingPriceLay  = _splPrices.OnPriceChange(isImage, runnerChange.Spl);


            newPrices.BestAvailableToBack        = _batbPrices.OnPriceChange(isImage, runnerChange.Batb);
            newPrices.BestAvailableToLay         = _batlPrices.OnPriceChange(isImage, runnerChange.Batl);
            newPrices.BestDisplayAvailableToBack = _bdatbPrices.OnPriceChange(isImage, runnerChange.Bdatb);
            newPrices.BestDisplayAvailableToLay  = _bdatlPrices.OnPriceChange(isImage, runnerChange.Bdatl);


            newPrices.StartingPriceNear = Utils.SelectPrice(isImage, ref _spn, runnerChange.Spn);
            newPrices.StartingPriceFar  = Utils.SelectPrice(isImage, ref _spf, runnerChange.Spf);
            newPrices.LastTradedPrice   = Utils.SelectPrice(isImage, ref _ltp, runnerChange.Ltp);
            newPrices.TradedVolume      = Utils.SelectPrice(isImage, ref _tv, runnerChange.Tv);

            //copy on write
            _runnerPrices = newPrices;
        }
Esempio n. 2
0
        private void OnPriceChange(bool isImage, RunnerChange runnerChange)
        {
            MarketRunner marketRunner = GetOrAdd(new RunnerId(runnerChange.Id, runnerChange.Hc));

            //update the runner
            marketRunner.OnPriceChange(isImage, runnerChange);
        }
Esempio n. 3
0
        public void OnRunnerChange(RunnerChange runnerChange, long?lastUpdated)
        {
            if (runnerChange?.SelectionId != SelectionId)
            {
                return;
            }

            LastPublishTime = lastUpdated;
            SetLastTradedPrice(runnerChange);
            SetTotalMatched(runnerChange);
            ProcessBestAvailableToBack(runnerChange.BestAvailableToBack);
            ProcessBestAvailableToLay(runnerChange.BestAvailableToLay);
            UpdateTradedLadder(runnerChange);
        }
Esempio n. 4
0
        private void ProcessRunnerChange(RunnerChange runnerChange)
        {
            if (runnerChange.SelectionId is null)
            {
                return;
            }
            var selectionId = (long)runnerChange.SelectionId;

            if (!Runners.ContainsKey(selectionId))
            {
                Runners.Add(selectionId, new RunnerCache(selectionId));
            }

            Runners[selectionId]
            .OnRunnerChange(runnerChange, LastPublishedTime);
        }
Esempio n. 5
0
 public MarketChangeStub WithRunnerChange(RunnerChange runnerChange)
 {
     RunnerChanges ??= new List <RunnerChange>();
     RunnerChanges.Add(runnerChange);
     return(this);
 }
Esempio n. 6
0
 private void SetLastTradedPrice(RunnerChange runnerChange)
 {
     LastTradedPrice = runnerChange.LastTradedPrice ?? LastTradedPrice;
 }
Esempio n. 7
0
 private void SetTotalMatched(RunnerChange runnerChange)
 {
     TotalMatched = runnerChange.TotalMatched ?? TotalMatched;
 }
Esempio n. 8
0
 private void UpdateTradedLadder(RunnerChange runnerChange)
 {
     TradedLadder.Update(
         runnerChange.Traded, LastPublishTime);
 }