Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlacingOrdersWithNoIntentToExecuteRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="orderFilter">
 /// The order filter.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="equityMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber.
 /// </param>
 /// <param name="tradingHoursService">
 /// The trading hours service.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingStackLogger">
 /// The trading stack logger.
 /// </param>
 public PlacingOrdersWithNoIntentToExecuteRule(
     IPlacingOrderWithNoIntentToExecuteRuleEquitiesParameters parameters,
     IUniverseOrderFilter orderFilter,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IUniverseAlertStream alertStream,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     IMarketTradingHoursService tradingHoursService,
     RuleRunMode runMode,
     ILogger logger,
     ILogger <TradingHistoryStack> tradingStackLogger)
     : base(
         TimeSpan.FromHours(24),
         TimeSpan.FromHours(24),
         TimeSpan.Zero,
         Domain.Surveillance.Scheduling.Rules.PlacingOrderWithNoIntentToExecute,
         EquityRulePlacingOrdersWithoutIntentToExecuteFactory.Version,
         "Placing Orders With No Intent To Execute Rule",
         ruleContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingStackLogger)
 {
     this.logger                = logger ?? throw new ArgumentNullException(nameof(logger));
     this.ruleContext           = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));
     this.alertStream           = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.dataRequestSubscriber = dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));
     this.orderFilter           = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
     this.parameters            = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.tradingHoursService   = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HighVolumeRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="operationContext">
 /// The operation context.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </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="currencyConverterService">
 /// The currency converter service.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public HighVolumeRule(
     IHighVolumeRuleEquitiesParameters equitiesParameters,
     ISystemProcessOperationRunRuleContext operationContext,
     IUniverseAlertStream alertStream,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IMarketTradingHoursService tradingHoursService,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     ICurrencyConverterService currencyConverterService,
     RuleRunMode runMode,
     ILogger <IHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters?.Windows.BackwardWindowSize ?? TimeSpan.FromDays(1),
         equitiesParameters?.Windows.BackwardWindowSize ?? TimeSpan.FromDays(1),
         equitiesParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Domain.Surveillance.Scheduling.Rules.HighVolume,
         EquityRuleHighVolumeFactory.Version,
         "High Volume Rule",
         operationContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.EquitiesParameters       = equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));
     this.AlertStream              = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     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.CurrencyConverterService = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighVolumeRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="orderFilterService">
 /// The order filter service.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="equityFactory">
 /// The factory.
 /// </param>
 /// <param name="fixedIncomeFactory">
 /// The factory.
 /// </param>
 /// <param name="judgementService">
 /// The judgement service.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber
 /// </param>
 /// <param name="tradingHoursService">
 /// The trading hours service
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingStackLogger">
 /// The trading stack logger.
 /// </param>
 public FixedIncomeHighVolumeRule(
     IHighVolumeIssuanceRuleFixedIncomeParameters parameters,
     IUniverseFixedIncomeOrderFilterService orderFilterService,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IFixedIncomeHighVolumeJudgementService judgementService,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     IMarketTradingHoursService tradingHoursService,
     RuleRunMode runMode,
     ILogger <FixedIncomeHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingStackLogger)
     : base(
         parameters.Windows.BackwardWindowSize,
         parameters.Windows.BackwardWindowSize,
         parameters.Windows.FutureWindowSize,
         Rules.FixedIncomeHighVolumeIssuance,
         FixedIncomeHighVolumeFactory.Version,
         $"{nameof(FixedIncomeHighVolumeRule)}",
         ruleContext,
         equityFactory,
         fixedIncomeFactory,
         runMode,
         logger,
         tradingStackLogger)
 {
     this.parameters            = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.orderFilterService    = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.judgementService      = judgementService ?? throw new ArgumentNullException(nameof(judgementService));
     this.dataRequestSubscriber = dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));
     this.tradingHoursService   = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 4
0
        public void Setup()
        {
            this._currencyConverterService = A.Fake <ICurrencyConverterService>();
            this._ruleCtx                = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream            = A.Fake <IUniverseAlertStream>();
            this._clustering             = new ClusteringService();
            this._equitiesParameters     = A.Fake <IWashTradeRuleEquitiesParameters>();
            this._logger                 = A.Fake <ILogger>();
            this._ruleRunRepository      = A.Fake <IRuleRunDataRequestRepository>();
            this._stubRuleRunRepository  = A.Fake <IStubRuleRunDataRequestRepository>();
            this._loggerEquityCache      = A.Fake <ILogger <UniverseEquityMarketCacheFactory> >();
            this._loggerFixedIncomeCache = A.Fake <ILogger <UniverseFixedIncomeMarketCacheFactory> >();
            this._tradingLogger          = A.Fake <ILogger <TradingHistoryStack> >();

            this._orderFilter   = A.Fake <IUniverseOrderFilter>();
            this._equityFactory = new UniverseEquityMarketCacheFactory(
                this._stubRuleRunRepository,
                this._ruleRunRepository,
                this._loggerEquityCache);
            this._fixedIncomeFactory = new UniverseFixedIncomeMarketCacheFactory(
                this._stubRuleRunRepository,
                this._ruleRunRepository,
                this._loggerFixedIncomeCache);
            A.CallTo(() => this._orderFilter.Filter(A <IUniverseEvent> .Ignored))
            .ReturnsLazily(i => (IUniverseEvent)i.Arguments[0]);

            A.CallTo(() => this._equitiesParameters.PerformClusteringPositionAnalysis).Returns(true);
            A.CallTo(() => this._equitiesParameters.ClusteringPercentageValueDifferenceThreshold).Returns(0.05m);
        }
Ejemplo n.º 5
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));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighProfitFactory"/> class.
 /// </summary>
 /// <param name="fixedIncomeOrderFilterService">
 /// The fixed income order filter service.
 /// </param>
 /// <param name="equityCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="marketDataCacheStrategyFactory">
 /// The market data cache strategy factory.
 /// </param>
 /// <param name="costCalculatorFactory">
 /// The cost calculator factory.
 /// </param>
 /// <param name="revenueCalculatorFactory">
 /// The revenue calculator factory.
 /// </param>
 /// <param name="exchangeRateProfitCalculator">
 /// The exchange rate profit calculator.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="stackLogger">
 /// The stack logger.
 /// </param>
 public FixedIncomeHighProfitFactory(
     IUniverseFixedIncomeOrderFilterService fixedIncomeOrderFilterService,
     IUniverseEquityMarketCacheFactory equityCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeCacheFactory,
     IFixedIncomeMarketDataCacheStrategyFactory marketDataCacheStrategyFactory,
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     ICurrencyConverterService currencyConverterService,
     ILogger <FixedIncomeHighProfitsRule> logger,
     ILogger <TradingHistoryStack> stackLogger)
 {
     this.fixedIncomeOrderFilterService =
         fixedIncomeOrderFilterService ?? throw new ArgumentNullException(nameof(fixedIncomeOrderFilterService));
     this.equityMarketCacheFactory =
         equityCacheFactory ?? throw new ArgumentNullException(nameof(equityCacheFactory));
     this.fixedIncomeCacheFactory =
         fixedIncomeCacheFactory ?? throw new ArgumentNullException(nameof(fixedIncomeCacheFactory));
     this.marketDataCacheStrategyFactory = marketDataCacheStrategyFactory ?? throw new ArgumentNullException(nameof(marketDataCacheStrategyFactory));
     this.costCalculatorFactory          =
         costCalculatorFactory ?? throw new ArgumentNullException(nameof(costCalculatorFactory));
     this.revenueCalculatorFactory     = revenueCalculatorFactory ?? throw new ArgumentNullException(nameof(revenueCalculatorFactory));
     this.exchangeRateProfitCalculator = exchangeRateProfitCalculator ?? throw new ArgumentNullException(nameof(exchangeRateProfitCalculator));
     this.currencyConverterService     = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     this.stackLogger = stackLogger ?? throw new ArgumentNullException(nameof(stackLogger));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayeringRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="orderFilter">
 /// The order filter.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </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="operationContext">
 /// The op context.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public LayeringRule(
     ILayeringRuleEquitiesParameters equitiesParameters,
     IUniverseAlertStream alertStream,
     IUniverseOrderFilter orderFilter,
     ILogger logger,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IMarketTradingHoursService tradingHoursService,
     ISystemProcessOperationRunRuleContext operationContext,
     RuleRunMode runMode,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(20),
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(20),
         equitiesParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Domain.Surveillance.Scheduling.Rules.Layering,
         EquityRuleLayeringFactory.Version,
         "Layering Rule",
         operationContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.equitiesParameters  = equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));
     this.logger              = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tradingHoursService = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.ruleContext         = operationContext ?? throw new ArgumentNullException(nameof(operationContext));
     this.alertStream         = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.orderFilter         = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="WashTradeRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="clustering">
 /// The clustering.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="currencyConverterService">
 /// The currency converter service.
 /// </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="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public WashTradeRule(
     IWashTradeRuleEquitiesParameters equitiesParameters,
     ISystemProcessOperationRunRuleContext ruleContext,
     IClusteringService clustering,
     IUniverseAlertStream alertStream,
     ICurrencyConverterService currencyConverterService,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     RuleRunMode runMode,
     ILogger logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         equitiesParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Rules.WashTrade,
         EquityRuleWashTradeFactory.Version,
         "Wash Trade Rule",
         ruleContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.equitiesParameters =
         equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));
     this.clustering = clustering ?? throw new ArgumentNullException(nameof(clustering));
     this.currencyConverterService =
         currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.orderFilter = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
     this.alertStream = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.logger      = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CancelledOrderRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="operationContext">
 /// The operation context.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </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="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public CancelledOrderRule(
     ICancelledOrderRuleEquitiesParameters parameters,
     ISystemProcessOperationRunRuleContext operationContext,
     IUniverseAlertStream alertStream,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     RuleRunMode runMode,
     ILogger <CancelledOrderRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(60),
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(60),
         parameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Rules.CancelledOrders,
         Versioner.Version(2, 0),
         "Cancelled Order Rule",
         operationContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.parameters       = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.operationContext = operationContext ?? throw new ArgumentNullException(nameof(operationContext));
     this.alertStream      = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.orderFilter      = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
     this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpoofingRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </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="runMode">
 /// The run mode.
 /// </param>
 /// <param name="portfolioFactory">
 /// The portfolio factory.
 /// </param>
 /// <param name="analysisService">
 /// The analysis service.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public SpoofingRule(
     ISpoofingRuleEquitiesParameters equitiesParameters,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseAlertStream alertStream,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     RuleRunMode runMode,
     IPortfolioFactory portfolioFactory,
     IOrderAnalysisService analysisService,
     ILogger logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(30),
         equitiesParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromMinutes(30),
         equitiesParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Rules.Spoofing,
         EquityRuleSpoofingFactory.Version,
         "Spoofing Rule",
         ruleContext,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.equitiesParameters =
         equitiesParameters ?? throw new ArgumentNullException(nameof(equitiesParameters));
     this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     this.alertStream      = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.orderFilter      = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));
     this.portfolioFactory = portfolioFactory ?? throw new ArgumentNullException(nameof(portfolioFactory));
     this.analysisService  = analysisService ?? throw new ArgumentNullException(nameof(analysisService));
     this.ruleContext      = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));
 }
 public EquityRuleHighProfitFactory(
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IEquityMarketDataCacheStrategyFactory cacheStrategyFactory,
     ICurrencyConverterService currencyConversionService,
     ILogger <HighProfitsRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._costCalculatorFactory =
         costCalculatorFactory ?? throw new ArgumentNullException(nameof(costCalculatorFactory));
     this._revenueCalculatorFactory = revenueCalculatorFactory
                                      ?? throw new ArgumentNullException(nameof(revenueCalculatorFactory));
     this._exchangeRateProfitCalculator = exchangeRateProfitCalculator
                                          ?? throw new ArgumentNullException(
                                                    nameof(exchangeRateProfitCalculator));
     this._equityMarketCacheFactory =
         equityMarketCacheFactory ?? throw new ArgumentNullException(nameof(equityMarketCacheFactory));
     this._fixedIncomeMarketCacheFactory =
         fixedIncomeMarketCacheFactory ?? throw new ArgumentNullException(nameof(fixedIncomeMarketCacheFactory));
     this._cacheStrategyFactory =
         cacheStrategyFactory ?? throw new ArgumentNullException(nameof(cacheStrategyFactory));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger =
         tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._currencyConversionService = currencyConversionService ?? throw new ArgumentNullException(nameof(currencyConversionService));
 }
Ejemplo n.º 12
0
        public void Setup()
        {
            _alertStream        = A.Fake <IUniverseAlertStream>();
            _equitiesParameters = A.Fake <IHighVolumeRuleEquitiesParameters>();
            _ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            _opCtx = A.Fake <ISystemProcessOperationContext>();
            _dataRequestRepository     = A.Fake <IRuleRunDataRequestRepository>();
            _stubDataRequestRepository = A.Fake <IStubRuleRunDataRequestRepository>();

            _equityFactoryCache = A.Fake <ILogger <UniverseEquityMarketCacheFactory> >();
            _equityFactory      = new UniverseEquityMarketCacheFactory(_stubDataRequestRepository, _dataRequestRepository, _equityFactoryCache);

            _fixedIncomeFactoryCache = A.Fake <ILogger <UniverseFixedIncomeMarketCacheFactory> >();
            _fixedIncomeFactory      = new UniverseFixedIncomeMarketCacheFactory(_stubDataRequestRepository, _dataRequestRepository, _fixedIncomeFactoryCache);

            _tradingHoursService          = A.Fake <IMarketTradingHoursService>();
            _dataRequestSubscriber        = A.Fake <IUniverseDataRequestsSubscriber>();
            this.currencyConverterService = A.Fake <ICurrencyConverterService>();
            _logger        = A.Fake <ILogger <IHighVolumeRule> >();
            _tradingLogger = A.Fake <ILogger <TradingHistoryStack> >();

            _orderFilter = A.Fake <IUniverseOrderFilter>();
            A.CallTo(() => _orderFilter.Filter(A <IUniverseEvent> .Ignored)).ReturnsLazily(i => (IUniverseEvent)i.Arguments[0]);

            A.CallTo(() => _ruleCtx.EndEvent()).Returns(_opCtx);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HighProfitMarketClosureRule"/> class.
 /// </summary>
 /// <param name="equitiesParameters">
 /// The equities parameters.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="costCalculatorFactory">
 /// The cost calculator factory.
 /// </param>
 /// <param name="revenueCalculatorFactory">
 /// The revenue calculator factory.
 /// </param>
 /// <param name="exchangeRateProfitCalculator">
 /// The exchange rate profit calculator.
 /// </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="marketDataCacheFactory">
 /// The market data cache factory.
 /// </param>
 /// <param name="dataRequestSubscriber">
 /// The data request subscriber.
 /// </param>
 /// <param name="judgementService">
 /// The judgement service.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingHistoryLogger">
 /// The trading history logger.
 /// </param>
 public HighProfitMarketClosureRule(
     IHighProfitsRuleEquitiesParameters equitiesParameters,
     ISystemProcessOperationRunRuleContext ruleContext,
     ICostCalculatorFactory costCalculatorFactory,
     IRevenueCalculatorFactory revenueCalculatorFactory,
     IExchangeRateProfitCalculator exchangeRateProfitCalculator,
     IUniverseOrderFilter orderFilter,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     IEquityMarketDataCacheStrategyFactory marketDataCacheFactory,
     IUniverseDataRequestsSubscriber dataRequestSubscriber,
     IHighProfitJudgementService judgementService,
     ICurrencyConverterService currencyConverterService,
     RuleRunMode runMode,
     ILogger <HighProfitsRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
     : base(
         equitiesParameters,
         ruleContext,
         costCalculatorFactory,
         revenueCalculatorFactory,
         exchangeRateProfitCalculator,
         orderFilter,
         equityMarketCacheFactory,
         fixedIncomeMarketCacheFactory,
         marketDataCacheFactory,
         dataRequestSubscriber,
         judgementService,
         currencyConverterService,
         runMode,
         logger,
         tradingHistoryLogger)
 {
     this.MarketClosureRule = true;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeWashTradeRule"/> class.
 /// </summary>
 /// <param name="parameters">
 /// The parameters.
 /// </param>
 /// <param name="orderFilterService">
 /// The order filter service.
 /// </param>
 /// <param name="ruleContext">
 /// The rule context.
 /// </param>
 /// <param name="equityFactory">
 /// The factory.
 /// </param>
 /// <param name="fixedIncomeFactory">
 /// The factory.
 /// </param>
 /// <param name="runMode">
 /// The run mode.
 /// </param>
 /// <param name="alertStream">
 /// The alert stream.
 /// </param>
 /// <param name="clusteringService">
 /// The clustering service.
 /// </param>
 /// <param name="portfolioFactory">
 /// The portfolio factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingStackLogger">
 /// The trading stack logger.
 /// </param>
 public FixedIncomeWashTradeRule(
     IWashTradeRuleFixedIncomeParameters parameters,
     IUniverseFixedIncomeOrderFilterService orderFilterService,
     ISystemProcessOperationRunRuleContext ruleContext,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     RuleRunMode runMode,
     IUniverseAlertStream alertStream,
     IClusteringService clusteringService,
     IPortfolioFactory portfolioFactory,
     ILogger <FixedIncomeWashTradeRule> logger,
     ILogger <TradingHistoryStack> tradingStackLogger)
     : base(
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         parameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromDays(1),
         parameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
         Rules.FixedIncomeWashTrades,
         Versioner.Version(1, 0),
         $"{nameof(FixedIncomeWashTradeRule)}",
         ruleContext,
         equityFactory,
         fixedIncomeFactory,
         runMode,
         logger,
         tradingStackLogger)
 {
     this.parameters         = parameters ?? throw new ArgumentNullException(nameof(parameters));
     this.orderFilterService = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.alertStream        = alertStream ?? throw new ArgumentNullException(nameof(alertStream));
     this.clusteringService  = clusteringService ?? throw new ArgumentNullException(nameof(clusteringService));
     this.portfolioFactory   = portfolioFactory ?? throw new ArgumentNullException(nameof(portfolioFactory));
     this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseUniverseRule"/> class.
        /// </summary>
        /// <param name="tradeBackwardWindowSize">
        /// The trade backward window size.
        /// </param>
        /// <param name="marketBackwardWindowSize">
        /// The market backward window size.
        /// </param>
        /// <param name="forwardWindowSize">
        /// The forward window size.
        /// </param>
        /// <param name="rules">
        /// The rules.
        /// </param>
        /// <param name="version">
        /// The version.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="ruleContext">
        /// The rule context.
        /// </param>
        /// <param name="equityFactory">
        /// The equity factory.
        /// </param>
        /// <param name="fixedIncomeFactory">
        /// The fixed income factory.
        /// </param>
        /// <param name="runMode">
        /// The run mode.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="tradingStackLogger">
        /// The trading stack logger.
        /// </param>
        protected BaseUniverseRule(
            TimeSpan tradeBackwardWindowSize,
            TimeSpan marketBackwardWindowSize,
            TimeSpan forwardWindowSize,
            Rules rules,
            string version,
            string name,
            ISystemProcessOperationRunRuleContext ruleContext,
            IUniverseEquityMarketCacheFactory equityFactory,
            IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
            RuleRunMode runMode,
            ILogger logger,
            ILogger <TradingHistoryStack> tradingStackLogger)
        {
            this.TradeBackwardWindowSize = tradeBackwardWindowSize;
            this.ForwardWindowSize       = forwardWindowSize;

            this.Rule    = rules;
            this.Version = version ?? string.Empty;

            this.UniverseEquityIntradayCache =
                equityFactory?.BuildIntraday(marketBackwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.FutureUniverseEquityIntradayCache =
                equityFactory?.BuildIntraday(forwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.UniverseEquityInterdayCache =
                equityFactory?.BuildInterday(runMode)
                ?? throw new ArgumentNullException(nameof(equityFactory));

            this.UniverseFixedIncomeIntradayCache =
                fixedIncomeFactory?.BuildIntraday(marketBackwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.FutureUniverseFixedIncomeIntradayCache =
                fixedIncomeFactory?.BuildIntraday(forwardWindowSize, runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.UniverseFixedIncomeInterdayCache =
                fixedIncomeFactory?.BuildInterday(runMode)
                ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));

            this.TradingHistory        = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.TradingFillsHistory   = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.TradingInitialHistory = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();

            this.DelayedTradingHistory        = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.DelayedTradingFillsHistory   = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();
            this.DelayedTradingInitialHistory = new ConcurrentDictionary <InstrumentIdentifiers, ITradingHistoryStack>();

            this.RuleCtx            = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));
            this.name               = name ?? "Unnamed rule";
            this.RunMode            = runMode;
            this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
            this.tradingStackLogger = tradingStackLogger ?? throw new ArgumentNullException(nameof(tradingStackLogger));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixedIncomeHighProfitsStreamRule"/> class.
        /// Constructor for the high profits stream rule
        /// </summary>
        /// <param name="fixedIncomeParameters">
        /// parameters from the client service user interface
        /// </param>
        /// <param name="ruleContext">
        /// auditing helper
        /// </param>
        /// <param name="costCalculatorFactory">
        /// cost logic service factory
        /// </param>
        /// <param name="revenueCalculatorFactory">
        /// revenue logic service factory
        /// </param>
        /// <param name="exchangeRateProfitCalculator">
        /// exchange rate service
        /// </param>
        /// <param name="orderFilter">
        /// classification financial instruments filtering service
        /// </param>
        /// <param name="equityMarketCacheFactory">
        /// time bar cache factory
        /// </param>
        /// /// <param name="fixedIncomeMarketCacheFactory">
        /// time bar cache factory
        /// </param>
        /// <param name="marketDataCacheFactory">
        /// market time bar cache factory
        /// </param>
        /// <param name="dataRequestSubscriber">
        /// data fetch pattern helper
        /// </param>
        /// <param name="judgementService">
        /// rule analysis service
        /// </param>
        /// <param name="runMode">
        /// forced or validation
        /// </param>
        /// <param name="logger">
        /// logging helper
        /// </param>
        /// <param name="tradingHistoryLogger">
        /// logging helper for trading history
        /// </param>
        public FixedIncomeHighProfitsStreamRule(
            IHighProfitsRuleFixedIncomeParameters fixedIncomeParameters,
            ISystemProcessOperationRunRuleContext ruleContext,
            ICostCalculatorFactory costCalculatorFactory,
            IRevenueCalculatorFactory revenueCalculatorFactory,
            IExchangeRateProfitCalculator exchangeRateProfitCalculator,
            IUniverseFixedIncomeOrderFilterService orderFilter,
            IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
            IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
            IFixedIncomeMarketDataCacheStrategyFactory marketDataCacheFactory,
            IUniverseDataRequestsSubscriber dataRequestSubscriber,
            IFixedIncomeHighProfitJudgementService judgementService,
            ICurrencyConverterService currencyService,
            RuleRunMode runMode,
            ILogger <FixedIncomeHighProfitsRule> logger,
            ILogger <TradingHistoryStack> tradingHistoryLogger)
            : base(
                fixedIncomeParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromHours(8),
                fixedIncomeParameters?.Windows?.BackwardWindowSize ?? TimeSpan.FromHours(8),
                fixedIncomeParameters?.Windows?.FutureWindowSize ?? TimeSpan.Zero,
                Domain.Surveillance.Scheduling.Rules.FixedIncomeHighProfits,
                FixedIncomeHighProfitFactory.Version,
                "Fixed Income High Profit Rule",
                ruleContext,
                equityMarketCacheFactory,
                fixedIncomeMarketCacheFactory,
                runMode,
                logger,
                tradingHistoryLogger)
        {
            this.FixedIncomeParameters =
                fixedIncomeParameters ?? throw new ArgumentNullException(nameof(fixedIncomeParameters));

            this.RuleCtx = ruleContext ?? throw new ArgumentNullException(nameof(ruleContext));

            this.costCalculatorFactory =
                costCalculatorFactory ?? throw new ArgumentNullException(nameof(costCalculatorFactory));

            this.revenueCalculatorFactory = revenueCalculatorFactory
                                            ?? throw new ArgumentNullException(nameof(revenueCalculatorFactory));

            this.marketDataCacheFactory =
                marketDataCacheFactory ?? throw new ArgumentNullException(nameof(marketDataCacheFactory));

            this.exchangeRateProfitCalculator = exchangeRateProfitCalculator
                                                ?? throw new ArgumentNullException(
                                                          nameof(exchangeRateProfitCalculator));

            this.orderFilter = orderFilter ?? throw new ArgumentNullException(nameof(orderFilter));

            this.dataRequestSubscriber =
                dataRequestSubscriber ?? throw new ArgumentNullException(nameof(dataRequestSubscriber));

            this.JudgementService         = judgementService ?? throw new ArgumentNullException(nameof(judgementService));
            this.currencyConverterService = currencyService ?? throw new ArgumentNullException(nameof(currencyService));

            this.Logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }
Ejemplo n.º 17
0
 public void Setup()
 {
     this.parameters                    = A.Fake <IHighVolumeIssuanceRuleFixedIncomeParameters>();
     this.fixedIncomeOrderFile          = A.Fake <IUniverseFixedIncomeOrderFilterService>();
     this.ruleContext                   = A.Fake <ISystemProcessOperationRunRuleContext>();
     this.equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
     this.fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
     this.marketTradingHoursService     = A.Fake <IMarketTradingHoursService>();
     this.tradingStackLogger            = new NullLogger <TradingHistoryStack>();
 }
Ejemplo n.º 18
0
        public void Setup()
        {
            this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._ruleRunContext            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._ruleRunMode               = RuleRunMode.ValidationRun;
            this._universeOrderFilter       = A.Fake <IUniverseOrderFilter>();
            this._timeWindows               = new TimeWindows("id-1", TimeSpan.FromDays(1));
            this._decimalRangeRuleFilter    = new DecimalRangeRuleFilter();
            this._marketTradingHoursService = A.Fake <IMarketTradingHoursService>();
            this._dataRequestSubscriber     = A.Fake <IUniverseDataRequestsSubscriber>();
            this._baseLogger    = A.Fake <ILogger>();
            this._tradingLogger = A.Fake <ILogger <TradingHistoryStack> >();
            this._logger        = A.Fake <ILogger <HighVolumeVenueFilter> >();

            A.CallTo(() => this._universeOrderFilter.Filter(A <IUniverseEvent> .Ignored))
            .ReturnsLazily(_ => _.Arguments.First() as IUniverseEvent);

            var repository = A.Fake <IMarketOpenCloseApiCachingDecorator>();

            A.CallTo(() => repository.GetAsync()).Returns(
                new[]
            {
                new ExchangeDto
                {
                    Code              = "XLON",
                    MarketOpenTime    = TimeSpan.FromHours(8),
                    MarketCloseTime   = TimeSpan.FromHours(16),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true
                },
                new ExchangeDto
                {
                    Code              = "NASDAQ",
                    MarketOpenTime    = TimeSpan.FromHours(15),
                    MarketCloseTime   = TimeSpan.FromHours(23),
                    IsOpenOnMonday    = true,
                    IsOpenOnTuesday   = true,
                    IsOpenOnWednesday = true,
                    IsOpenOnThursday  = true,
                    IsOpenOnFriday    = true,
                    IsOpenOnSaturday  = true,
                    IsOpenOnSunday    = true
                }
            });

            this._tradingHoursService = new MarketTradingHoursService(
                repository,
                new NullLogger <MarketTradingHoursService>());
        }
Ejemplo n.º 19
0
        public void Setup()
        {
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger               = A.Fake <ILogger <CancelledOrderRule> >();
            this._tradingHistoryLogger = A.Fake <ILogger <TradingHistoryStack> >();

            this._parameters  = A.Fake <ICancelledOrderRuleEquitiesParameters>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
Ejemplo n.º 20
0
 public void Setup()
 {
     this._parameters           = A.Fake <IWashTradeRuleFixedIncomeParameters>();
     this._fixedIncomeOrderFile = A.Fake <IUniverseFixedIncomeOrderFilterService>();
     this._ruleCtx = A.Fake <ISystemProcessOperationRunRuleContext>();
     this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
     this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
     this._alertStream        = A.Fake <IUniverseAlertStream>();
     this._clusteringService  = A.Fake <IClusteringService>();
     this._portfolioFactory   = A.Fake <IPortfolioFactory>();
     this._logger             = new NullLogger <FixedIncomeHighProfitsRule>();
     this._tradingStackLogger = new NullLogger <TradingHistoryStack>();
 }
        public void Setup()
        {
            this._currencyConverterService = A.Fake <ICurrencyConverterService>();
            this._clustering           = A.Fake <IClusteringService>();
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger               = new NullLogger <WashTradeRule>();
            this._tradingHistoryLogger = new NullLogger <TradingHistoryStack>();

            this._equitiesParameters = A.Fake <IWashTradeRuleEquitiesParameters>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();
        }
Ejemplo n.º 22
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>();
        }
Ejemplo n.º 23
0
        public void Setup()
        {
            this._orderFilterService   = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityFactory        = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeFactory   = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._portfolioFactory     = A.Fake <IPortfolioFactory>();
            this._orderAnalysisService = A.Fake <IOrderAnalysisService>();
            this._logger = new NullLogger <SpoofingRule>();
            this._tradingHistoryLogger = new NullLogger <TradingHistoryStack>();

            this._spoofingEquitiesParameters = A.Fake <ISpoofingRuleEquitiesParameters>();
            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
 public EquityRuleCancelledOrderFactory(
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     ILogger <CancelledOrderRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this._orderFilterService =
         orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this._equityFactory        = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this._fixedIncomeFactory   = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this._logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     this._tradingHistoryLogger = tradingHistoryLogger;
 }
Ejemplo n.º 25
0
        public void Setup()
        {
            _orderFilterService           = A.Fake <IUniverseEquityOrderFilterService>();
            _equityFactory                = A.Fake <IUniverseEquityMarketCacheFactory>();
            _fixedIncomeFactory           = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            _tradingHoursService          = A.Fake <IMarketTradingHoursService>();
            this.currencyConverterService = A.Fake <ICurrencyConverterService>();
            _logger = A.Fake <ILogger <IHighVolumeRule> >();
            _tradingHistoryLogger = A.Fake <ILogger <TradingHistoryStack> >();

            _equitiesParameters = A.Fake <IHighVolumeRuleEquitiesParameters>();
            _opCtx                 = A.Fake <ISystemProcessOperationRunRuleContext>();
            _alertStream           = A.Fake <IUniverseAlertStream>();
            _dataRequestSubscriber = A.Fake <IUniverseDataRequestsSubscriber>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FixedIncomeHighVolumeFactory"/> class.
 /// </summary>
 /// <param name="filterService">
 /// The filter service.
 /// </param>
 /// <param name="equityMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="fixedIncomeMarketCacheFactory">
 /// The market cache factory.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="tradingLogger">
 /// The trading logger.
 /// </param>
 /// <param name="marketTradingHoursService">
 /// The trading hours service.
 /// </param>
 public FixedIncomeHighVolumeFactory(
     IUniverseFixedIncomeOrderFilterService filterService,
     IUniverseEquityMarketCacheFactory equityMarketCacheFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeMarketCacheFactory,
     ILogger <FixedIncomeHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingLogger,
     IMarketTradingHoursService marketTradingHoursService)
 {
     this.filterService            = filterService ?? throw new ArgumentNullException(nameof(filterService));
     this.equityMarketCacheFactory =
         equityMarketCacheFactory ?? throw new ArgumentNullException(nameof(this.equityMarketCacheFactory));
     this.fixedIncomeMarketCacheFactory =
         fixedIncomeMarketCacheFactory ?? throw new ArgumentNullException(nameof(this.fixedIncomeMarketCacheFactory));
     this.marketTradingHoursService = marketTradingHoursService ?? throw new ArgumentNullException(nameof(marketTradingHoursService));
     this.logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tradingLogger = tradingLogger ?? throw new ArgumentNullException(nameof(tradingLogger));
 }
 public EquityRuleHighVolumeFactory(
     IUniverseEquityOrderFilterService orderFilterService,
     IUniverseEquityMarketCacheFactory equityFactory,
     IUniverseFixedIncomeMarketCacheFactory fixedIncomeFactory,
     IMarketTradingHoursService tradingHoursService,
     ICurrencyConverterService currencyConverterService,
     ILogger <IHighVolumeRule> logger,
     ILogger <TradingHistoryStack> tradingHistoryLogger)
 {
     this.orderFilterService       = orderFilterService ?? throw new ArgumentNullException(nameof(orderFilterService));
     this.equityFactory            = equityFactory ?? throw new ArgumentNullException(nameof(equityFactory));
     this.fixedIncomeFactory       = fixedIncomeFactory ?? throw new ArgumentNullException(nameof(fixedIncomeFactory));
     this.tradingHoursService      = tradingHoursService ?? throw new ArgumentNullException(nameof(tradingHoursService));
     this.currencyConverterService = currencyConverterService ?? throw new ArgumentNullException(nameof(currencyConverterService));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.tradingHistoryLogger = tradingHistoryLogger ?? throw new ArgumentNullException(nameof(tradingHistoryLogger));
 }
        private void Setup()
        {
            this._orderFilterService = A.Fake <IUniverseFixedIncomeOrderFilterService>();
            this._ruleCtx            = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream        = A.Fake <IUniverseAlertStream>();

            this._portfolioFactory         = new PortfolioFactory();
            this._clusteringService        = new ClusteringService();
            this._equityMarketCacheFactory = new UniverseEquityMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseEquityMarketCacheFactory>());
            this._fixedIncomeMarketCacheFactory = new UniverseFixedIncomeMarketCacheFactory(
                new StubRuleRunDataRequestRepository(),
                new StubRuleRunDataRequestRepository(),
                new NullLogger <UniverseFixedIncomeMarketCacheFactory>());
        }
Ejemplo n.º 29
0
        public WashTradeSteps(ScenarioContext scenarioContext, UniverseSelectionState universeSelectionState)
        {
            this._scenarioContext        = scenarioContext;
            this._universeSelectionState = universeSelectionState;

            var exchangeRateApiRepository = A.Fake <IExchangeRateApiCachingDecorator>();

            var exchangeRateDto = new ExchangeRateDto
            {
                DateTime         = new DateTime(2018, 01, 01),
                Name             = "GBX/USD",
                FixedCurrency    = "GBX",
                VariableCurrency = "USD",
                Rate             = 200d
            };

            A.CallTo(() => exchangeRateApiRepository.GetAsync(A <DateTime> .Ignored, A <DateTime> .Ignored)).Returns(
                new Dictionary <DateTime, IReadOnlyCollection <ExchangeRateDto> >
            {
                { new DateTime(2018, 01, 01), new[] { exchangeRateDto } }
            });

            var currencyLogger = new NullLogger <CurrencyConverterService>();

            this._currencyConverterService = new CurrencyConverterService(exchangeRateApiRepository, currencyLogger);

            this._washTradeClustering           = new ClusteringService();
            this._universeOrderFilterService    = A.Fake <IUniverseEquityOrderFilterService>();
            this._equityMarketCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeMarketCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._logger        = new NullLogger <WashTradeRule>();
            this._tradingLogger = new NullLogger <TradingHistoryStack>();

            this._equityRuleWashTradeFactory = new EquityRuleWashTradeFactory(
                this._currencyConverterService,
                this._washTradeClustering,
                this._universeOrderFilterService,
                this._equityMarketCacheFactory,
                this._fixedIncomeMarketCacheFactory,
                this._logger,
                this._tradingLogger);

            this._ruleCtx     = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._alertStream = A.Fake <IUniverseAlertStream>();
        }
        public void Setup()
        {
            this._ruleCtx                 = A.Fake <ISystemProcessOperationRunRuleContext>();
            this._parameters              = A.Fake <ICancelledOrderRuleEquitiesParameters>();
            this._alertStream             = A.Fake <IUniverseAlertStream>();
            this._equityCacheFactory      = A.Fake <IUniverseEquityMarketCacheFactory>();
            this._fixedIncomeCacheFactory = A.Fake <IUniverseFixedIncomeMarketCacheFactory>();
            this._ruleRunRepository       = A.Fake <IRuleRunDataRequestRepository>();
            this._stubRuleRunRepository   = A.Fake <IStubRuleRunDataRequestRepository>();
            this._equityLoggerCache       = A.Fake <ILogger <UniverseEquityMarketCacheFactory> >();
            this._fixedIncomeLoggerCache  = A.Fake <ILogger <UniverseFixedIncomeMarketCacheFactory> >();
            this._logger = A.Fake <ILogger <CancelledOrderRule> >();
            this._tradingHistoryLogger = A.Fake <ILogger <TradingHistoryStack> >();

            this._orderFilter = A.Fake <IUniverseOrderFilter>();
            A.CallTo(() => this._orderFilter.Filter(A <IUniverseEvent> .Ignored))
            .ReturnsLazily(i => (IUniverseEvent)i.Arguments[0]);
        }