Ejemplo n.º 1
0
        private void WriteMessage(InstrumentBidAskPair quote, string message, EventTypeEnum eventType)
        {
            _log.WriteInfoAsync(nameof(QuotesMonitor), quote.ToJson(), message);
            var slackChannelType = _alertSeverityLevelService.GetSlackChannelType(eventType);

            if (!string.IsNullOrWhiteSpace(slackChannelType))
            {
                _slackNotificationsSender.SendRawAsync(slackChannelType, nameof(QuotesMonitor), message);
            }
        }
Ejemplo n.º 2
0
        private void CommitStopOut(MarginTradingAccount account, InstrumentBidAskPair quote)
        {
            if (account.IsInLiquidation())
            {
                return;
            }

            var liquidationType = account.GetUsedMargin() == account.GetCurrentlyUsedMargin()
                ? LiquidationType.Normal
                : LiquidationType.Mco;

            _cqrsSender.SendCommandToSelf(new StartLiquidationInternalCommand
            {
                OperationId     = _identityGenerator.GenerateGuid(),//TODO: use quote correlationId
                AccountId       = account.Id,
                CreationTime    = _dateService.Now(),
                QuoteInfo       = quote?.ToJson(),
                LiquidationType = liquidationType,
                OriginatorType  = OriginatorType.System,
            });

            _stopOutEventChannel.SendEvent(this, new StopOutEventArgs(account));
        }