Esempio n. 1
0
        /// <summary>
        /// Loads MarketData Metadata
        /// </summary>
        /// <remarks>
        /// Loads MarketData Metadata
        /// </remarks>
        /// <returns></returns>
        public async Task Load(CancellationToken ctk = default)
        {
            _entity = await _marketDataService.ReadMarketDataRegistryAsync(this.Identifier, ctk);

            if (_entity != null)
            {
                Metadata = new MarketDataMetadata(_entity);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// MarketData Update
        /// </summary>
        /// <remarks>
        /// Update the MarketData
        /// </remarks>
        /// <returns></returns>
        public async Task Update(CancellationToken ctk = default)
        {
            if (_entity == null)
            {
                throw new ArtesianFactoryException("Market Data is not yet registered");
            }

            var marketDataEntityInput = new MarketDataEntity.Input(_entity);

            _entity = await _marketDataService.UpdateMarketDataAsync(marketDataEntityInput, ctk);

            Metadata = new MarketDataMetadata(_entity);
        }
Esempio n. 3
0
        /// <summary>
        /// MarketData Register
        /// </summary>
        /// <remarks>
        /// Register a MarketData
        /// </remarks>
        /// <param name="metadata">The entity of metadata</param>
        /// <param name="ctk">CancellationToken</param>
        /// <returns></returns>
        public async Task Register(MarketDataEntity.Input metadata, CancellationToken ctk = default)
        {
            EnsureArg.IsNotNull(metadata, nameof(metadata));
            EnsureArg.IsTrue(metadata.ProviderName == null || metadata.ProviderName == this.Identifier.Provider);
            EnsureArg.IsTrue(metadata.ProviderName == null || metadata.ProviderName == this.Identifier.Provider);
            EnsureArg.IsTrue(metadata.MarketDataName == null || metadata.MarketDataName == this.Identifier.Name);
            EnsureArg.IsNotNullOrWhiteSpace(metadata.OriginalTimezone);

            metadata.ProviderName   = this.Identifier.Provider;
            metadata.MarketDataName = this.Identifier.Name;

            if (_entity != null)
            {
                throw new ArtesianFactoryException("Market Data is already registered with ID {0}", _entity.MarketDataId);
            }

            _entity = await _marketDataService.RegisterMarketDataAsync(metadata, ctk);

            Metadata = new MarketDataMetadata(_entity);
        }