Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeedMessageMapper" /> class
        /// </summary>
        /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> implementation used to construct <see cref="ISportEvent"/> instances</param>
        /// <param name="nameProviderFactory">A <see cref="INameProviderFactory"/> instance used build <see cref="INameProvider"/> instances used to get/create market/outcome names</param>
        /// <param name="mappingProviderFactory">A factory used to construct <see cref="IMarketMappingProvider"/> instances</param>
        /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to obtain descriptions for named values</param>
        /// <param name="externalExceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the publicly available instance constructed by current instance should handle potential exceptions</param>
        /// <param name="producerManager">An <see cref="IProducerManager"/> used to get <see cref="IProducer"/></param>
        /// <param name="marketCacheProvider">The SDK market cache provider used to retrieve market data</param>
        /// <param name="voidReasonCache">A <see cref="INamedValueCache"/> for possible void reasons</param>
        public FeedMessageMapper(ISportEntityFactory sportEntityFactory,
                                 INameProviderFactory nameProviderFactory,
                                 IMarketMappingProviderFactory mappingProviderFactory,
                                 INamedValuesProvider namedValuesProvider,
                                 ExceptionHandlingStrategy externalExceptionStrategy,
                                 IProducerManager producerManager,
                                 IMarketCacheProvider marketCacheProvider,
                                 INamedValueCache voidReasonCache)
        {
            Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull();
            Guard.Argument(nameProviderFactory, nameof(nameProviderFactory)).NotNull();
            Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull();
            Guard.Argument(producerManager, nameof(producerManager)).NotNull();
            Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull();
            Guard.Argument(voidReasonCache, nameof(voidReasonCache)).NotNull();

            _nameProviderFactory       = nameProviderFactory;
            _sportEntityFactory        = sportEntityFactory;
            _mappingProviderFactory    = mappingProviderFactory;
            _namedValuesProvider       = namedValuesProvider;
            _externalExceptionStrategy = externalExceptionStrategy;
            _producerManager           = producerManager;
            _marketCacheProvider       = marketCacheProvider;
            _voidReasonCache           = voidReasonCache;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeedMessageMapper" /> class
        /// </summary>
        /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> implementation used to construct <see cref="ISportEvent"/> instances</param>
        /// <param name="nameProviderFactory">A <see cref="INameProviderFactory"/> instance used build <see cref="INameProvider"/> instances used to get/create market/outcome names</param>
        /// <param name="mappingProviderFactory">A factory used to construct <see cref="IMarketMappingProvider"/> instances</param>
        /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to obtain descriptions for named values</param>
        /// <param name="externalExceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the publicly available instance constructed by current instance should handle potential exceptions</param>
        /// <param name="producerManager">An <see cref="IProducerManager"/> used to get <see cref="IProducer"/></param>
        /// <param name="marketCacheProvider">The SDK market cache provider used to retrieve market data</param>
        /// <param name="voidReasonCache">A <see cref="INamedValueCache"/> for possible void reasons</param>
        public FeedMessageMapper(ISportEntityFactory sportEntityFactory,
                                 INameProviderFactory nameProviderFactory,
                                 IMarketMappingProviderFactory mappingProviderFactory,
                                 INamedValuesProvider namedValuesProvider,
                                 ExceptionHandlingStrategy externalExceptionStrategy,
                                 IProducerManager producerManager,
                                 IMarketCacheProvider marketCacheProvider,
                                 INamedValueCache voidReasonCache)
        {
            Contract.Requires(sportEntityFactory != null);
            Contract.Requires(nameProviderFactory != null);
            Contract.Requires(namedValuesProvider != null);
            Contract.Requires(producerManager != null);
            Contract.Requires(marketCacheProvider != null);
            Contract.Requires(voidReasonCache != null);

            _nameProviderFactory       = nameProviderFactory;
            _sportEntityFactory        = sportEntityFactory;
            _mappingProviderFactory    = mappingProviderFactory;
            _namedValuesProvider       = namedValuesProvider;
            _externalExceptionStrategy = externalExceptionStrategy;
            _producerManager           = producerManager;
            _marketCacheProvider       = marketCacheProvider;
            _voidReasonCache           = voidReasonCache;
        }
Пример #3
0
        /// <summary>Initializes a new instance of the <see cref="OddsChange{T}" /> class</summary>
        /// <param name="timestamp">The value specifying timestamps related to the message (in the milliseconds since EPOCH UTC)</param>
        /// <param name="producer">The <see cref="IProducer" /> specifying the producer / service which dispatched the current <see cref="Message" /> message</param>
        /// <param name="event">An <see cref="ICompetition" /> derived instance representing the sport event associated with the current <see cref="EventMessage{T}" /></param>
        /// <param name="betStopReason">The <see cref="BetStopReason" /> enum member specifying the reason for betting being stopped, or a null reference if the reason is not known</param>
        /// <param name="bettingStatus">A <see cref="BettingStatus"/> enum indicating whether the betting should be allowed</param>
        /// <param name="markets">An <see cref="IMarketMessage{T,T1}" /> describing markets associated with the current <see cref="IMarketMessage{T, R}" /></param>
        /// <param name="namedValuesProvider">The <see cref="INamedValuesProvider"/> used to provide names for betting status and bet stop reason</param>
        /// <param name="rawMessage">The raw message</param>
        public CashOutProbabilities(IMessageTimestamp timestamp, IProducer producer, T @event, int?betStopReason, int?bettingStatus, IEnumerable <IMarketWithProbabilities> markets, INamedValuesProvider namedValuesProvider, byte[] rawMessage)
            : base(timestamp, producer, @event, null, markets, rawMessage)
        {
            Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull();

            _betStopReason      = betStopReason;
            _bettingStatus      = bettingStatus;
            _namedValueProvider = namedValuesProvider;
        }
        /// <summary>Initializes a new instance of the <see cref="OddsChange{T}" /> class</summary>
        /// <param name="timestamp">The value specifying timestamps related to the message (in the milliseconds since EPOCH UTC)</param>
        /// <param name="producer">The <see cref="IProducer" /> specifying the producer / service which dispatched the current <see cref="Message" /> message</param>
        /// <param name="event">An <see cref="ICompetition" /> derived instance representing the sport event associated with the current <see cref="EventMessage{T}" /></param>
        /// <param name="betStopReason">The <see cref="BetStopReason" /> enum member specifying the reason for betting being stopped, or a null reference if the reason is not known</param>
        /// <param name="bettingStatus">A <see cref="BettingStatus"/> enum indicating whether the betting should be allowed</param>
        /// <param name="markets">An <see cref="IMarketMessage{T,T1}" /> describing markets associated with the current <see cref="IMarketMessage{T, R}" /></param>
        /// <param name="namedValuesProvider">The <see cref="INamedValuesProvider"/> used to provide names for betting status and bet stop reason</param>
        /// <param name="rawMessage">The raw message</param>
        public CashOutProbabilities(IMessageTimestamp timestamp, IProducer producer, T @event, int?betStopReason, int?bettingStatus, IEnumerable <IMarketWithProbabilities> markets, INamedValuesProvider namedValuesProvider, byte[] rawMessage)
            : base(timestamp, producer, @event, null, markets, rawMessage)
        {
            Contract.Requires(namedValuesProvider != null);

            _betStopReason      = betStopReason;
            _bettingStatus      = bettingStatus;
            _namedValueProvider = namedValuesProvider;
        }
Пример #5
0
        /// <summary>Initializes a new instance of the <see cref="OddsChange{T}" /> class</summary>
        /// <param name="timestamp">The value specifying timestamps related to the message (in the milliseconds since EPOCH UTC)</param>
        /// <param name="producer">The <see cref="IProducer" /> specifying the producer / service which dispatched the current <see cref="Message" /> message</param>
        /// <param name="event">An <see cref="ICompetition" /> derived instance representing the sport event associated with the current <see cref="EventMessage{T}" /></param>
        /// <param name="requestId">The id of the request which triggered the current <see cref="EventMessage{T}" /> message or a null reference</param>
        /// <param name="changeReason">a <see cref="EventMessage{T}" /> member specifying the reason for the odds change</param>
        /// <param name="betStopReason">the <see cref="BetStopReason" /> enum member specifying the reason for betting being stopped, or a null reference if the reason is not known</param>
        /// <param name="bettingStatus">a <see cref="BettingStatus"/> enum indicating whether the betting should be allowed</param>
        /// <param name="markets">An <see cref="IMarketMessage{T,T1}" /> describing markets associated with the current <see cref="IMarketMessage{T, R}" /></param>
        /// <param name="oddsGenerationProperties">Provided by the prematch odds producer only, and contains a few key-parameters that can be used in a client’s own special odds model, or even offer spread betting bets based on it</param>
        /// <param name="namedValuesProvider">The <see cref="INamedValuesProvider"/> used to provide names for betting status and bet stop reason</param>
        /// <param name="rawMessage">The raw message</param>
        public OddsChange(IMessageTimestamp timestamp, IProducer producer, T @event, long?requestId, OddsChangeReason?changeReason, int?betStopReason, int?bettingStatus, IEnumerable <IMarketWithOdds> markets, oddsGenerationProperties oddsGenerationProperties, INamedValuesProvider namedValuesProvider, byte[] rawMessage)
            : base(timestamp, producer, @event, requestId, markets, rawMessage)
        {
            Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull();

            _namedValueProvider      = namedValuesProvider;
            ChangeReason             = changeReason;
            _betStopReason           = betStopReason;
            _bettingStatus           = bettingStatus;
            OddsGenerationProperties = oddsGenerationProperties == null
                                           ? null
                                           : new OddsGeneration(oddsGenerationProperties);
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IFeedMessageValidator"/> class
        /// </summary>
        /// <param name="marketCacheProvider">The <see cref="IMarketCacheProvider"/> used to get <see cref="IMarketDescription"/></param>
        /// <param name="defaultCulture">The default culture used to retrieve <see cref="IMarketDescription"/></param>
        /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to provide descriptions for named values</param>
        /// <param name="producerManager">A <see cref="IProducerManager"/> used to check available producers</param>
        public FeedMessageValidator(IMarketCacheProvider marketCacheProvider, CultureInfo defaultCulture, INamedValuesProvider namedValuesProvider, IProducerManager producerManager)
        {
            Contract.Requires(marketCacheProvider != null);
            Contract.Requires(defaultCulture != null);
            Contract.Requires(namedValuesProvider != null);
            Contract.Requires(producerManager != null);

            _marketCacheProvider = marketCacheProvider;
            _defaultCulture      = new List <CultureInfo> {
                defaultCulture
            };
            _namedValuesProvider = namedValuesProvider;
            _producerManager     = producerManager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IFeedMessageValidator"/> class
        /// </summary>
        /// <param name="marketCacheProvider">The <see cref="IMarketCacheProvider"/> used to get <see cref="IMarketDescription"/></param>
        /// <param name="defaultCulture">The default culture used to retrieve <see cref="IMarketDescription"/></param>
        /// <param name="namedValuesProvider">A <see cref="INamedValuesProvider"/> used to provide descriptions for named values</param>
        /// <param name="producerManager">A <see cref="IProducerManager"/> used to check available producers</param>
        public FeedMessageValidator(IMarketCacheProvider marketCacheProvider, CultureInfo defaultCulture, INamedValuesProvider namedValuesProvider, IProducerManager producerManager)
        {
            Guard.Argument(marketCacheProvider, nameof(marketCacheProvider)).NotNull();
            Guard.Argument(defaultCulture, nameof(defaultCulture)).NotNull();
            Guard.Argument(namedValuesProvider, nameof(namedValuesProvider)).NotNull();
            Guard.Argument(producerManager, nameof(producerManager)).NotNull();

            _marketCacheProvider = marketCacheProvider;
            _defaultCulture      = new List <CultureInfo> {
                defaultCulture
            };
            _namedValuesProvider = namedValuesProvider;
            _producerManager     = producerManager;
        }