Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MarkingTheCloseRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="orderFilter">
 /// The order filter.
 /// </param>
 /// <param name="equityMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="tradingHoursService">
 /// The trading hours service.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public MarkingTheCloseRule(
     IMarkingTheCloseEquitiesParameters equitiesParameters,
     IUniverseAlertStream alertStream,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IMarketTradingHoursService tradingHoursService,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     RuleRunMode runMode,
     ILogger <MarkingTheCloseRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(30),
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(30),
         equitiesParameters?.Windows?.FutureWindowSize ?? TimeSpan.FromMinutes(30),
         Domain.Surveillance.Scheduling.Rules.MarkingTheClose,
         EquityRuleMarkingTheCloseFactory.Version,
         "Marking The Close",
         ruleContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.equitiesParameters    = equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));
     this.alertStream           = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.ruleContext           = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));
     this.orderFilter           = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
     this.tradingHoursService   = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.dataRequestSubscriber = dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Пример #2
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;
        }
Пример #3
0
        public void Setup()
        {
            this._orderFilterService  = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory       = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory  = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._tradingHoursService = A.Fake <IMarketTradingHoursService>();
            this._logger = new NullLogger <MarkingTheCloseRule>();
            this._tradingHistoryLogger  = new NullLogger <TradingHistoryStack>();
            this._dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();

            this._equitiesParameters = A.Fake <IMarkingTheCloseEquitiesParameters>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();
        }
 public IMarkingTheCloseRule Build(
     IMarkingTheCloseEquitiesParameters equitiesParameters,
     ISystemProcessOperationRunRuleContext ruleCtx,
     IUniverseAlertStream alertStream,
     RuleRunMode runMode,
     IUniverseDataRequestsSubscriber dataRequestSubscriber)
 {
     return(new MarkingTheCloseRule(
                equitiesParameters,
                alertStream,
                ruleCtx,
                this._orderFilterService,
                this._equityFactory,
                this._fixedIncomeFactory,
                this._tradingHoursService,
                dataRequestSubscriber,
                runMode,
                this._logger,
                this._tradingHistoryLogger));
 }