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; }
private void OnPriceChange(bool isImage, RunnerChange runnerChange) { MarketRunner marketRunner = GetOrAdd(new RunnerId(runnerChange.Id, runnerChange.Hc)); //update the runner marketRunner.OnPriceChange(isImage, runnerChange); }
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); }
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); }
public MarketChangeStub WithRunnerChange(RunnerChange runnerChange) { RunnerChanges ??= new List <RunnerChange>(); RunnerChanges.Add(runnerChange); return(this); }
private void SetLastTradedPrice(RunnerChange runnerChange) { LastTradedPrice = runnerChange.LastTradedPrice ?? LastTradedPrice; }
private void SetTotalMatched(RunnerChange runnerChange) { TotalMatched = runnerChange.TotalMatched ?? TotalMatched; }
private void UpdateTradedLadder(RunnerChange runnerChange) { TradedLadder.Update( runnerChange.Traded, LastPublishTime); }