Ejemplo n.º 1
0
        private async Task HandleChangeSettingsMessage(SettingsChangedEvent message)
        {
            switch (message.SettingsType)
            {
            case SettingsTypeContract.Asset:
                await _assetsManager.UpdateCacheAsync();

                break;

            case SettingsTypeContract.AssetPair:
                //AssetPair change handled in AssetPairProjection
                break;

            case SettingsTypeContract.TradingCondition:
                await _tradingConditionsManager.InitTradingConditionsAsync();

                break;

            case SettingsTypeContract.TradingInstrument:
                await _tradingInstrumentsManager.UpdateTradingInstrumentsCacheAsync(message.ChangedEntityId);

                break;

            case SettingsTypeContract.TradingRoute:
                await _matchingEngineRoutesManager.UpdateRoutesCacheAsync();

                break;

            case SettingsTypeContract.ScheduleSettings:
                await _scheduleSettingsCacheService.UpdateAllSettingsAsync();

                _overnightMarginService.ScheduleNext();
                break;

            case SettingsTypeContract.Market:
                break;

            case SettingsTypeContract.ServiceMaintenance:
                break;

            default:
                throw new NotImplementedException($"Type {message.SettingsType} is not supported");
            }
        }
        public async Task Handle(MarketSettingsChangedEvent e)
        {
            switch (e.ChangeType)
            {
            case ChangeType.Creation:
            case ChangeType.Edition:
                if (e.OldMarketSettings == null || IsScheduleDataChanged(e.OldMarketSettings, e.NewMarketSettings))
                {
                    await _scheduleSettingsCache.UpdateAllSettingsAsync();

                    _overnightMarginService.ScheduleNext();
                    _scheduleControlService.ScheduleNext();
                }
                break;

            case ChangeType.Deletion:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }