Exemplo n.º 1
0
        public MarkingTheCloseBreach(
            IFactorValue factorValue,
            ISystemProcessOperationContext operationContext,
            string correlationId,
            TimeSpan window,
            FinancialInstrument security,
            MarketOpenClose marketClose,
            ITradePosition tradingPosition,
            IMarkingTheCloseEquitiesParameters equitiesParameters,
            VolumeBreach dailyBreach,
            VolumeBreach windowBreach,
            string description,
            string caseTitle,
            DateTime universeDateTime)
        {
            this.FactorValue = factorValue;

            this.Window   = window;
            this.Security = security ?? throw new ArgumentNullException(nameof(security));

            this.MarketClose        = marketClose ?? throw new ArgumentNullException(nameof(marketClose));
            this.Trades             = tradingPosition ?? new TradePosition(new List <Order>());
            this.EquitiesParameters = equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));

            this.DailyBreach  = dailyBreach;
            this.WindowBreach = windowBreach;

            this.RuleParameterId   = equitiesParameters?.Id ?? string.Empty;
            this.SystemOperationId = operationContext.Id.ToString();
            this.CorrelationId     = correlationId;
            this.RuleParameters    = equitiesParameters;
            this.Description       = description ?? string.Empty;
            this.CaseTitle         = caseTitle ?? string.Empty;
            this.UniverseDateTime  = universeDateTime;
        }
Exemplo n.º 2
0
        /// <summary>
        /// The market close.
        /// </summary>
        /// <param name="exchange">
        /// The exchange.
        /// </param>
        protected override void MarketClose(MarketOpenClose exchange)
        {
            this.Logger.LogInformation(
                $"Trading closed for exchange {exchange.MarketId}. Running market closure virtual profits check.");

            this.RunRuleForAllDelayedTradingHistoriesInMarket(exchange, this.UniverseDateTime);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The run rule for all trading histories in market.
        /// </summary>
        /// <param name="closeOpen">
        /// The close open.
        /// </param>
        /// <param name="currentTimeInUniverse">
        /// The current time in universe.
        /// </param>
        protected void RunRuleForAllTradingHistoriesInMarket(MarketOpenClose closeOpen, DateTime?currentTimeInUniverse = null)
        {
            lock (this.@lock)
            {
                if (closeOpen == null)
                {
                    return;
                }

                this.logger?.LogInformation($"Base universe rule for {this.name} - Run rule for all trading histories for the market {closeOpen.MarketId} {currentTimeInUniverse}");

                var filteredTradingHistories =
                    this.TradingHistory
                    .Where(th =>
                           string.Equals(
                               th.Value?.Exchange()?.MarketIdentifierCode,
                               closeOpen.MarketId,
                               StringComparison.InvariantCultureIgnoreCase))
                    .ToList();

                foreach (var history in filteredTradingHistories)
                {
                    if (currentTimeInUniverse != null)
                    {
                        history.Value.ArchiveExpiredActiveItems(currentTimeInUniverse.Value);
                    }

                    this.RunPostOrderEvent(history.Value);
                }
            }
        }
        /// <summary>
        /// The market open any/all.
        /// </summary>
        /// <param name="exchange">
        /// The exchange.
        /// </param>
        protected override void MarketOpen(MarketOpenClose exchange)
        {
            this.logger.LogInformation(
                $"{nameof(FixedIncomeHighVolumeRule)} MarketOpen called at {this.UniverseDateTime}");

            this.logger.LogInformation(
                $"{nameof(FixedIncomeHighVolumeRule)} MarketOpen completed for {this.UniverseDateTime}");
        }
Exemplo n.º 5
0
        /// <summary>
        /// The market close.
        /// </summary>
        /// <param name="exchange">
        /// The exchange.
        /// </param>
        protected override void MarketClose(MarketOpenClose exchange)
        {
            this.logger.LogInformation($"Market Close ({exchange?.MarketId}) occurred at {exchange?.MarketClose}");

            this.processingMarketClose = true;
            this.latestMarketClosure   = exchange;
            this.RunRuleForAllTradingHistoriesInMarket(exchange, exchange?.MarketClose);
            this.processingMarketClose = false;
        }
        /// <summary>
        /// The market close.
        /// </summary>
        /// <param name="exchange">
        /// The exchange.
        /// </param>
        protected override void MarketClose(MarketOpenClose exchange)
        {
            this.logger.LogInformation("Market Close occurred");

            this.RunRuleForAllTradingHistoriesInMarket(exchange);
        }
 /// <summary>
 /// The market open.
 /// </summary>
 /// <param name="exchange">
 /// The exchange.
 /// </param>
 protected override void MarketOpen(MarketOpenClose exchange)
 {
     this.logger.LogInformation($"Market Open ({exchange?.MarketId}) occurred {exchange?.MarketOpen}");
 }
 /// <summary>
 /// The market open.
 /// </summary>
 /// <param name="exchange">
 /// The exchange.
 /// </param>
 protected override void MarketOpen(MarketOpenClose exchange)
 {
     this.logger.LogInformation($"Trading Opened for exchange {exchange.MarketId}");
 }
Exemplo n.º 9
0
        /// <summary>
        /// The market open.
        /// </summary>
        /// <param name="exchange">
        /// The exchange.
        /// </param>
        protected override void MarketOpen(MarketOpenClose exchange)
        {
            this.logger.LogInformation($"MarketOpen called at {this.UniverseDateTime} for {exchange.MarketId}");

            this.logger.LogInformation($"MarketOpen completed for {this.UniverseDateTime} for {exchange.MarketId}");
        }
Exemplo n.º 10
0
 /// <summary>
 /// The market close.
 /// </summary>
 /// <param name="exchange">
 /// The exchange.
 /// </param>
 protected abstract void MarketClose(MarketOpenClose exchange);
 /// <summary>
 /// The market open.
 /// </summary>
 /// <param name="exchange">
 /// The exchange.
 /// </param>
 protected override void MarketOpen(MarketOpenClose exchange)
 {
 }