Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StorageMetaInfoMessageAdapter"/>.
 /// </summary>
 /// <param name="innerAdapter">The adapter, to which messages will be directed.</param>
 /// <param name="securityStorage">Securities meta info storage.</param>
 /// <param name="positionStorage">Position storage.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 public StorageMetaInfoMessageAdapter(IMessageAdapter innerAdapter, ISecurityStorage securityStorage, IPositionStorage positionStorage, IExchangeInfoProvider exchangeInfoProvider)
     : base(innerAdapter)
 {
     _securityStorage      = securityStorage ?? throw new ArgumentNullException(nameof(securityStorage));
     _positionStorage      = positionStorage ?? throw new ArgumentNullException(nameof(positionStorage));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(_exchangeInfoProvider));
 }
Esempio n. 2
0
 public ConvertableStorage(Security security, IMarketDataStorage <TMessage> messageStorage, IExchangeInfoProvider exchangeInfoProvider, Func <TEntity, TMessage> toMessage)
 {
     _security             = security;
     _messageStorage       = messageStorage ?? throw new ArgumentNullException(nameof(messageStorage));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));
     _toMessage            = toMessage ?? throw new ArgumentNullException(nameof(toMessage));
 }
        internal static DateTimeOffset GetExpirationTime(this Security security, IExchangeInfoProvider provider)
        {
            if (security == null)
            {
                throw new ArgumentNullException(nameof(security));
            }

            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            if (security.ExpiryDate == null)
            {
                throw new ArgumentException(LocalizedStrings.Str709Params.Put(security.Id), nameof(security));
            }

            var expDate = security.ExpiryDate.Value;

            if (expDate.TimeOfDay == TimeSpan.Zero)
            {
                var board = provider.GetOrCreateBoard(security.ToSecurityId().BoardCode);
                expDate += board.ExpiryTime;
            }

            return(expDate);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BasketSecurityMessageAdapter"/>.
 /// </summary>
 /// <param name="securityProvider">The provider of information about instruments.</param>
 /// <param name="processorProvider">Basket security processors provider.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 /// <param name="innerAdapter">Underlying adapter.</param>
 public BasketSecurityMessageAdapter(ISecurityProvider securityProvider, IBasketSecurityProcessorProvider processorProvider, IExchangeInfoProvider exchangeInfoProvider, IMessageAdapter innerAdapter)
     : base(innerAdapter)
 {
     _securityProvider     = securityProvider ?? throw new ArgumentNullException(nameof(securityProvider));
     _processorProvider    = processorProvider ?? throw new ArgumentNullException(nameof(processorProvider));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvImporter"/>.
 /// </summary>
 /// <param name="dataType">Data type info.</param>
 /// <param name="fields">Importing fields.</param>
 /// <param name="securityStorage">Securities meta info storage.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 /// <param name="drive">The storage. If a value is <see langword="null" />, <see cref="IStorageRegistry.DefaultDrive"/> will be used.</param>
 /// <param name="storageFormat">The format type. By default <see cref="StorageFormats.Binary"/> is passed.</param>
 public CsvImporter(DataType dataType, IEnumerable <FieldMapping> fields, ISecurityStorage securityStorage, IExchangeInfoProvider exchangeInfoProvider, IMarketDataDrive drive, StorageFormats storageFormat)
     : base(dataType, fields)
 {
     _securityStorage      = securityStorage ?? throw new ArgumentNullException(nameof(securityStorage));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));
     _drive         = drive;
     _storageFormat = storageFormat;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvImporter"/>.
 /// </summary>
 /// <param name="dataType">Data type info.</param>
 /// <param name="fields">Importing fields.</param>
 /// <param name="entityRegistry">The storage of trade objects.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 /// <param name="drive">The storage. If a value is <see langword="null" />, <see cref="IStorageRegistry.DefaultDrive"/> will be used.</param>
 /// <param name="storageFormat">The format type. By default <see cref="StorageFormats.Binary"/> is passed.</param>
 public CsvImporter(DataType dataType, IEnumerable <FieldMapping> fields, IEntityRegistry entityRegistry, IExchangeInfoProvider exchangeInfoProvider, IMarketDataDrive drive, StorageFormats storageFormat)
     : base(dataType, fields)
 {
     _entityRegistry       = entityRegistry ?? throw new ArgumentNullException(nameof(entityRegistry));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));
     _drive         = drive;
     _storageFormat = storageFormat;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StorageMetaInfoMessageAdapter"/>.
 /// </summary>
 /// <param name="innerAdapter">The adapter, to which messages will be directed.</param>
 /// <param name="securityStorage">Securities meta info storage.</param>
 /// <param name="positionStorage">Position storage.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 /// <param name="storageRegistry">The storage of market data.</param>
 /// <param name="snapshotRegistry">Snapshot storage registry.</param>
 /// <param name="candleBuilderProvider">Candle builders provider.</param>
 public StorageMetaInfoMessageAdapter(IMessageAdapter innerAdapter, ISecurityStorage securityStorage,
                                      IPositionStorage positionStorage, IExchangeInfoProvider exchangeInfoProvider,
                                      IStorageRegistry storageRegistry, SnapshotRegistry snapshotRegistry, CandleBuilderProvider candleBuilderProvider)
     : base(innerAdapter, storageRegistry, snapshotRegistry, candleBuilderProvider)
 {
     _securityStorage      = securityStorage ?? throw new ArgumentNullException(nameof(securityStorage));
     _positionStorage      = positionStorage ?? throw new ArgumentNullException(nameof(positionStorage));
     _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(_exchangeInfoProvider));
 }
Esempio n. 8
0
        public CandleBinarySerializer(SecurityId securityId, object arg, IExchangeInfoProvider exchangeInfoProvider)
            : base(securityId, 74, MarketDataVersions.Version57, exchangeInfoProvider)
        {
            if (arg == null)
            {
                throw new ArgumentNullException(nameof(arg));
            }

            _arg = arg;
        }
Esempio n. 9
0
		private void FillBoards(IExchangeInfoProvider provider)
		{
			var itemsSource = new ObservableCollectionEx<ExchangeBoard> { _emptyBoard };
			var boards = new ThreadSafeObservableCollection<ExchangeBoard>(itemsSource);

			boards.AddRange(provider.Boards);

			provider.BoardAdded += boards.Add;
			
			Boards = boards;
		}
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeFrameCandleBuilder"/>.
        /// </summary>
        public TimeFrameCandleBuilder(IExchangeInfoProvider exchangeInfoProvider)
        {
            if (exchangeInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(exchangeInfoProvider));
            }

            _exchangeInfoProvider = exchangeInfoProvider;

            GenerateEmptyCandles = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CandleBuilderProvider"/>.
        /// </summary>
        /// <param name="exchangeInfoProvider">The exchange boards provider.</param>
        public CandleBuilderProvider(IExchangeInfoProvider exchangeInfoProvider)
        {
            ExchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));

            Register(new TimeFrameCandleBuilder(exchangeInfoProvider));
            Register(new TickCandleBuilder(exchangeInfoProvider));
            Register(new VolumeCandleBuilder(exchangeInfoProvider));
            Register(new RangeCandleBuilder(exchangeInfoProvider));
            Register(new RenkoCandleBuilder(exchangeInfoProvider));
            Register(new PnFCandleBuilder(exchangeInfoProvider));
        }
Esempio n. 12
0
        private void FillBoards(IExchangeInfoProvider provider)
        {
            var itemsSource = new ObservableCollectionEx <ExchangeBoard> {
                _emptyBoard
            };
            var boards = new ThreadSafeObservableCollection <ExchangeBoard>(itemsSource);

            boards.AddRange(provider.Boards);

            provider.BoardAdded += boards.Add;

            Boards = boards;
        }
Esempio n. 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteStorageClient"/>.
        /// </summary>
        /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
        /// <param name="address">Server address.</param>
        /// <param name="streaming">Data transfer via WCF Streaming.</param>
        public RemoteStorageClient(IExchangeInfoProvider exchangeInfoProvider, Uri address, bool streaming = true)
            : base(address, "hydra")
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }

            ExchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));

            _streaming        = streaming;
            Credentials       = new ServerCredentials();
            SecurityBatchSize = 1000;
        }
		private void UpdateProvider(IExchangeInfoProvider provider)
		{
			_boards.Clear();

			if (_exchangeInfoProvider != null)
				_exchangeInfoProvider.BoardAdded -= _boards.Add;

			_exchangeInfoProvider = provider;

			if (_exchangeInfoProvider != null)
			{
				_boards.AddRange(_exchangeInfoProvider.Boards);
				_exchangeInfoProvider.BoardAdded += _boards.Add;
			}
		}
Esempio n. 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BatchEmulation"/>.
        /// </summary>
        /// <param name="securityProvider">The provider of information about instruments.</param>
        /// <param name="portfolioProvider">The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.</param>
        /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
        /// <param name="storageRegistry">Market data storage.</param>
        /// <param name="storageFormat">The format of market data. <see cref="StorageFormats.Binary"/> is used by default.</param>
        /// <param name="drive">The storage which is used by default. By default, <see cref="IStorageRegistry.DefaultDrive"/> is used.</param>
        public BatchEmulation(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry, StorageFormats storageFormat = StorageFormats.Binary, IMarketDataDrive drive = null)
        {
            _securityProvider     = securityProvider ?? throw new ArgumentNullException(nameof(securityProvider));
            _portfolioProvider    = portfolioProvider ?? throw new ArgumentNullException(nameof(portfolioProvider));
            _exchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));

            EmulationSettings = new EmulationSettings();

            StorageSettings = new StorageCoreSettings
            {
                StorageRegistry = storageRegistry,
                Drive           = drive,
                Format          = storageFormat,
            };
        }
Esempio n. 16
0
        public ExchangeEditorViewModel(ExchangeEditor editor, IExchangeInfoProvider provider)
        {
            if (editor == null)
            {
                throw new ArgumentNullException("editor");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _editor   = editor;
            _provider = provider;
            _isNew    = true;
        }
Esempio n. 17
0
        private void UpdateProvider(IExchangeInfoProvider provider)
        {
            _exchanges.Clear();

            if (_exchangeInfoProvider != null)
            {
                _exchangeInfoProvider.ExchangeAdded -= _exchanges.Add;
            }

            _exchangeInfoProvider = provider;

            if (_exchangeInfoProvider != null)
            {
                _exchanges.AddRange(_exchangeInfoProvider.Exchanges);
                _exchangeInfoProvider.ExchangeAdded += _exchanges.Add;
            }
        }
Esempio n. 18
0
        protected BinaryMarketDataSerializer(SecurityId securityId, int dataSize, Version version, IExchangeInfoProvider exchangeInfoProvider)
        {
            if (securityId == null)
            {
                throw new ArgumentNullException(nameof(securityId));
            }

            if (exchangeInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(exchangeInfoProvider));
            }

            SecurityId = securityId;
            DataSize   = dataSize;

            Version = version;
            ExchangeInfoProvider = exchangeInfoProvider;
        }
Esempio n. 19
0
        public ConvertableAllSecurityMarketDataStorage(Security security,
                                                       object arg,
                                                       Func <TMessage, DateTimeOffset> getTime,
                                                       Func <TMessage, Security> getSecurity,
                                                       Func <TEntity, DateTimeOffset> getEntityTime,
                                                       Func <Security, IMarketDataDrive, IMarketDataStorage <TMessage> > getStorage,
                                                       IMarketDataStorageDrive drive,
                                                       IExchangeInfoProvider exchangeInfoProvider)
            : base(security, arg, getTime, getSecurity, getStorage, drive, exchangeInfoProvider)
        {
            if (getEntityTime == null)
            {
                throw new ArgumentNullException(nameof(getEntityTime));
            }

            _security      = security;
            _getEntityTime = getEntityTime;
        }
Esempio n. 20
0
        public ExchangeBoardEditorViewModel(ExchangeBoardEditor editor, IExchangeInfoProvider provider)
        {
            if (editor == null)
            {
                throw new ArgumentNullException(nameof(editor));
            }

            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            _editor    = editor;
            Provider   = provider;
            IsNewBoard = true;

            NewPeriodTill        = new DateTime(DateTime.Now.Year + 1, 1, 1) - TimeSpan.FromDays(1);
            NewTimeFrom          = NewTimeTill = DateTime.MinValue;
            NewSpecialWorkingDay = NewSpecialHoliday = new DateTime(DateTime.Now.Year, 1, 1);
        }
Esempio n. 21
0
        /// <summary>
        /// Initialize <see cref="RemoteStorage"/>.
        /// </summary>
        /// <param name="storageRegistry">Market-data storage.</param>
        /// <param name="securityStorage">Securities meta info storage.</param>
        /// <param name="extendedInfoStorage">Extended info <see cref="Message.ExtensionInfo"/> storage.</param>
        /// <param name="exchangeInfoProvider">The exchange boards provider.</param>
        protected RemoteStorage(IStorageRegistry storageRegistry, ISecurityStorage securityStorage,
                                IExtendedInfoStorage extendedInfoStorage, IExchangeInfoProvider exchangeInfoProvider)
        {
            StorageRegistry      = storageRegistry ?? throw new ArgumentNullException(nameof(storageRegistry));
            SecurityStorage      = securityStorage ?? throw new ArgumentNullException(nameof(securityStorage));
            ExtendedInfoStorage  = extendedInfoStorage ?? throw new ArgumentNullException(nameof(extendedInfoStorage));
            ExchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));

            AddDataType(typeof(ExecutionMessage));
            AddDataType(typeof(Level1ChangeMessage));
            AddDataType(typeof(QuoteChangeMessage));
            AddDataType(typeof(NewsMessage));

            foreach (var candleType in StockSharp.Messages.Extensions.AllCandleTypes)
            {
                AddDataType(candleType);
            }

            AddDataType(typeof(PositionChangeMessage));
        }
Esempio n. 22
0
        /// <summary>
        /// Initialize <see cref="RemoteStorage"/>.
        /// </summary>
        /// <param name="storageRegistry">Market-data storage.</param>
        /// <param name="securityStorage">Securities meta info storage.</param>
        /// <param name="extendedInfoStorage">Extended info <see cref="Message.ExtensionInfo"/> storage.</param>
        /// <param name="exchangeInfoProvider">The exchange boards provider.</param>
        protected RemoteStorage(IStorageRegistry storageRegistry, ISecurityStorage securityStorage,
                                IExtendedInfoStorage extendedInfoStorage, IExchangeInfoProvider exchangeInfoProvider)
        {
            StorageRegistry      = storageRegistry ?? throw new ArgumentNullException(nameof(storageRegistry));
            SecurityStorage      = securityStorage ?? throw new ArgumentNullException(nameof(securityStorage));
            ExtendedInfoStorage  = extendedInfoStorage ?? throw new ArgumentNullException(nameof(extendedInfoStorage));
            ExchangeInfoProvider = exchangeInfoProvider ?? throw new ArgumentNullException(nameof(exchangeInfoProvider));

            AddDataType(typeof(ExecutionMessage));
            AddDataType(typeof(Level1ChangeMessage));
            AddDataType(typeof(QuoteChangeMessage));
            AddDataType(typeof(NewsMessage));

            AddDataType(typeof(TimeFrameCandleMessage));
            AddDataType(typeof(RangeCandleMessage));
            AddDataType(typeof(RenkoCandleMessage));
            AddDataType(typeof(PnFCandleMessage));
            AddDataType(typeof(TickCandleMessage));
            AddDataType(typeof(VolumeCandleMessage));

            AddDataType(typeof(PositionChangeMessage));
        }
Esempio n. 23
0
        private Security InitSecurity(SecurityId securityId, IExchangeInfoProvider exchangeInfoProvider)
        {
            var id       = securityId.ToStringId();
            var security = _entityRegistry.Securities.ReadById(id);

            if (security != null)
            {
                return(security);
            }

            security = new Security
            {
                Id    = id,
                Code  = securityId.SecurityCode,
                Board = exchangeInfoProvider.GetOrCreateBoard(securityId.BoardCode),
                Type  = securityId.SecurityType,
            };

            _entityRegistry.Securities.Save(security);
            this.AddInfoLog(LocalizedStrings.Str2871Params.Put(id));

            return(security);
        }
Esempio n. 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CandleBuilderMessageAdapter"/>.
        /// </summary>
        /// <param name="innerAdapter">Inner message adapter.</param>
        /// <param name="exchangeInfoProvider">The exchange boards provider.</param>
        public CandleBuilderMessageAdapter(IMessageAdapter innerAdapter, IExchangeInfoProvider exchangeInfoProvider)
            : base(innerAdapter)
        {
            if (exchangeInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(exchangeInfoProvider));
            }

            _exchangeInfoProvider = exchangeInfoProvider;

            BuildCandlesFrom      = MarketDataTypes.Trades;
            DepthCandleSourceType = DepthCandleSourceTypes.Middle;

            _candleBuilders = new CandleBuildersList
            {
                new TimeFrameCandleBuilder(exchangeInfoProvider),
                new TickCandleBuilder(),
                new VolumeCandleBuilder(),
                new RangeCandleBuilder(),
                new RenkoCandleBuilder(),
                new PnFCandleBuilder(),
            };
        }
Esempio n. 25
0
        public static TimeSpan GetTimeZone(this BinaryMetaInfo metaInfo, bool isUtc, SecurityId securityId, IExchangeInfoProvider exchangeInfoProvider)
        {
            if (isUtc)
            {
                return(metaInfo.ServerOffset);
            }

            var board = exchangeInfoProvider.GetExchangeBoard(securityId.BoardCode);

            return(board == null ? metaInfo.LocalOffset : board.TimeZone.BaseUtcOffset);
        }
Esempio n. 26
0
 public OrderLogBinarySerializer(SecurityId securityId, IExchangeInfoProvider exchangeInfoProvider)
     : base(securityId, 200, MarketDataVersions.Version53, exchangeInfoProvider)
 {
 }
Esempio n. 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HistoryEmulationConnector"/>.
        /// </summary>
        /// <param name="innerAdapter">Underlying adapter.</param>
        /// <param name="ownInnerAdapter">Control <paramref name="innerAdapter"/> lifetime.</param>
        /// <param name="inChannel">Incoming messages channel.</param>
        /// <param name="securityProvider">The provider of information about instruments.</param>
        /// <param name="portfolioProvider">The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.</param>
        /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
        public HistoryEmulationConnector(IMessageAdapter innerAdapter, bool ownInnerAdapter, IMessageChannel inChannel, ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
            : base(new EmulationMessageAdapter(innerAdapter, inChannel, true, securityProvider, portfolioProvider, exchangeInfoProvider) { OwnInnerAdapter = ownInnerAdapter }, false, false)
        {
            MarketTimeChangedInterval = HistoryMessageAdapter.MarketTimeChangedInterval;

            Adapter.LatencyManager    = null;
            Adapter.CommissionManager = null;
            Adapter.PnLManager        = null;
            Adapter.SlippageManager   = null;

            Adapter.SupportSecurityAll = false;

            Adapter.SendFinishedCandlesImmediatelly = true;

            InMessageChannel  = new PassThroughMessageChannel();
            OutMessageChannel = new PassThroughMessageChannel();

            // при тестировании по свечкам, время меняется быстрее и таймаут должен быть больше 30с.
            //ReConnectionSettings.TimeOutInterval = TimeSpan.MaxValue;

            //MaxMessageCount = 1000;

            //Adapter.SupportCandlesCompression = false;
            Adapter.SupportBuildingFromOrderLog          = false;
            Adapter.SupportPartialDownload               = false;
            Adapter.SupportLookupTracking                = false;
            Adapter.SupportOrderBookTruncate             = false;
            Adapter.ConnectDisconnectEventOnFirstAdapter = false;

            MarketTimeChanged += OnMarketTimeChanged;
            Disconnected      += OnDisconnected;
        }
Esempio n. 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HistoryEmulationConnector"/>.
 /// </summary>
 /// <param name="securityProvider">The provider of information about instruments.</param>
 /// <param name="portfolioProvider">The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.</param>
 /// <param name="storageRegistry">Market data storage.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry)
     : this(new HistoryMessageAdapter(new IncrementalIdGenerator(), securityProvider) { StorageRegistry = storageRegistry }, true, new InMemoryMessageChannel(new MessageByLocalTimeQueue(), "Emulator in", err => err.LogError()), securityProvider, portfolioProvider, exchangeInfoProvider)
 {
 }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HistoryEmulationConnector"/>.
 /// </summary>
 /// <param name="securityProvider">The provider of information about instruments.</param>
 /// <param name="portfolioProvider">The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.</param>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 public HistoryEmulationConnector(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
     : this(securityProvider, portfolioProvider, exchangeInfoProvider, new StorageRegistry(exchangeInfoProvider))
 {
 }
Esempio n. 30
0
        /// <summary>
        /// Initialize <see cref="EmulationMessageAdapter"/>.
        /// </summary>
        /// <param name="innerAdapter">Underlying adapter.</param>
        /// <param name="inChannel">Incoming messages channel.</param>
        /// <param name="isEmulationOnly">Send <see cref="TimeMessage"/> to emulator.</param>
        /// <param name="securityProvider">The provider of information about instruments.</param>
        /// <param name="portfolioProvider">The portfolio to be used to register orders. If value is not given, the portfolio with default name Simulator will be created.</param>
        /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
        public EmulationMessageAdapter(IMessageAdapter innerAdapter, IMessageChannel inChannel, bool isEmulationOnly, ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider)
            : base(innerAdapter)
        {
            Emulator = new MarketEmulator(securityProvider, portfolioProvider, exchangeInfoProvider, TransactionIdGenerator)
            {
                Parent   = this,
                Settings =
                {
                    ConvertTime    = true,
                    InitialOrderId = DateTime.Now.Ticks,
                    InitialTradeId = DateTime.Now.Ticks,
                }
            };

            InChannel = inChannel;

            _inAdapter = new SubscriptionOnlineMessageAdapter(Emulator);
            _inAdapter = new ChannelMessageAdapter(_inAdapter, inChannel, new PassThroughMessageChannel());
            _inAdapter.NewOutMessage += RaiseNewOutMessage;

            _isEmulationOnly = isEmulationOnly;
        }
Esempio n. 31
0
 public CandleBinarySerializer(SecurityId securityId, object arg, IExchangeInfoProvider exchangeInfoProvider)
     : base(securityId, arg, 74, MarketDataVersions.Version60, exchangeInfoProvider)
 {
 }
Esempio n. 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteStorageClient"/>.
 /// </summary>
 /// <param name="exchangeInfoProvider">Exchanges and trading boards provider.</param>
 public RemoteStorageClient(IExchangeInfoProvider exchangeInfoProvider)
     : this(exchangeInfoProvider, "net.tcp://localhost:8000".To <Uri>())
 {
 }