Exemplo n.º 1
0
        public void StateInfoChanged()
        {
            string connectionString = Configuration.ConnectionBuilders(AccountType.Gross, Configuration.ConnectionType.Feed).First().ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnFeedLogon;

            connectionString = Configuration.ConnectionBuilders(AccountType.Gross, Configuration.ConnectionType.Trade).First().ToString();
            this.dataTrade = new DataTrade(connectionString);
            this.dataTrade.Logon += this.OnTradeLogon;

            StateCalculator stateCalculator = new StateCalculator(dataTrade, dataFeed);
            stateCalculator.StateInfoChanged += StateCalculator_StateInfoChanged;

            this.dataFeed.Start();
            this.dataTrade.Start();
            var status = this.feedLogonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of feed logon event");
            status = this.tradeLogonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of trade logon event");

            status = this.stateInfoEvent.WaitOne(LogonWaitingTimeout*10000);

            this.dataFeed.Stop();
            this.dataTrade.Stop();
            this.dataFeed.Logon -= this.OnFeedLogon;
            this.dataTrade.Logon -= this.OnTradeLogon;
        }
Exemplo n.º 2
0
        public BarsTimeIntervalEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
            : base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize)
        {
            this.endTime = endTime;

            this.Reset();
        }
Exemplo n.º 3
0
        public BarsCountEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int barsNumber, int preferredBufferSize)
            : base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize)
        {
            this.barsNumber = barsNumber;

            this.Reset();
        }
Exemplo n.º 4
0
Arquivo: TestBase.cs Projeto: ifzz/FDK
 public void Cleanup()
 {
     Cleanup(this.dataFeed);
     this.dataFeed = null;
     Cleanup(this.dataTrade);
     this.dataTrade = null;
 }
Exemplo n.º 5
0
 public static void RegisterToFeed(DataFeed feed, FinancialCalculator calculator)
 {
     feed.Tick += (object sender, TickEventArgs e) =>
     {
         calculator.Prices.Update(e.Tick.Symbol, e.Tick.Bid, e.Tick.Ask);
     };
     feed.Server.SubscribeToQuotes(Symbols.Select(symbol=>symbol.Name), 1);            
 }
Exemplo n.º 6
0
        public void StartFeed()
        {
            if (this.dataClient != null)
                throw new InvalidOperationException("Start method can be called only once.");

            var connectionString = this.Builder.ToString();
            var feed = new DataFeed(connectionString);
            feed.SymbolInfo += this.OnSymbolInfo;
            this.dataClient = feed;
            this.dataClient.Start();
        }
Exemplo n.º 7
0
 public void Cleanup()
 {
     if (this.dataFeed != null)
     {
         if (this.dataFeed.IsStarted)
         {
             this.dataFeed.Stop();
         }
         this.dataFeed.Dispose();
         this.dataFeed = null;
     }
 }
Exemplo n.º 8
0
        static DataFeed CreateDataFeed()
        {
            var builder = new FixConnectionStringBuilder
            {
                SecureConnection = true,
                Port = 5003,
                Address = Settings.Default.DataSources_FDK_Server,
                Username = Settings.Default.DataSources_FDK_Username,
                Password = Settings.Default.DataSources_FDK_Password,
            };

            var dataFeed = new DataFeed(builder.ToString());
            return dataFeed;
        }
Exemplo n.º 9
0
        public StorageDataSourceProvider()
        {
            this.dataFeed = CreateDataFeed();
            this.storage = new DataFeedStorage(Settings.Default.DataSources_FDK_StorageLocation, StorageProvider.Ntfs, this.dataFeed, flushOnDispose: true);
            this.dataFeed.Start();

            var symbols = this.GetSymbols();

            var sources = symbols.Select(o =>
                {
                    return new []
                    {
                        new SymbolBarsDataSource(this.dataFeed, this.storage, o, PriceType.Bid),
                        new SymbolBarsDataSource(this.dataFeed, this.storage, o, PriceType.Ask)
                    };
                });

            this.DataSources = sources.SelectMany(o => o)
                                      .ToArray();
        }
Exemplo n.º 10
0
Arquivo: Snapshot.cs Projeto: ifzz/FDK
        internal Snapshot(DataTrade trade, DataFeed feed, StateCalculator calculator, object synchronizer, AutoResetEvent syncEvent)
        {
            this.synchronizer = synchronizer;
            this.syncEvent = syncEvent;
            this.calculator = calculator;

            this.Quotes = new Dictionary<string, Quote>();

            trade.Logon += this.OnTradeLogon;
            trade.SessionInfo += this.OnTradeSession;
            trade.AccountInfo += this.OnAccountInfo;
            trade.Logout += this.OnTradeLogout;

            feed.Logon += this.OnFeedLogon;
            feed.Logout += this.OnFeedLogout;
            feed.SymbolInfo += this.OnFeedSymbolInfo;
            feed.SessionInfo += this.OnFeedSessionInfo;

            calculator.StateInfoChanged += this.OnFinancialInfoChanged;
        }
Exemplo n.º 11
0
        static void ValidateArguments(DataFeed datafeed, string symbol, BarPeriod period, int preferredBufferSize)
        {
            if (datafeed == null)
            {
                throw new ArgumentNullException(nameof(datafeed), "DataFeed instance can not be null.");
            }

            if (symbol == null)
            {
                throw new ArgumentNullException(nameof(symbol), "Symbol can not be null.");
            }

            if (period == null)
            {
                throw new ArgumentNullException(nameof(period), "Bar period instance can not be null.");
            }

            if (preferredBufferSize <= 1)
            {
                throw new ArgumentOutOfRangeException(nameof(preferredBufferSize), preferredBufferSize, "Preferred buffer size should be more than 1.");
            }
        }
Exemplo n.º 12
0
        void BackwardBarsEnumeration(ConnectionStringBuilder builder)
        {
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");

            var startTime = new DateTime(2015, 10, 10, 12, 0, 0, 0, DateTimeKind.Utc);
            var endTime = new DateTime(2015, 10, 10, 12, 1, 0, 0, DateTimeKind.Utc);

            var data = new List<Bar>();
            var bars = new Bars(this.dataFeed, "EURUSD", PriceType.Bid, BarPeriod.S1, endTime, startTime);

            foreach (var element in bars)
            {
                Assert.IsTrue(startTime <= element.From, "startTime <= element.From");
                Assert.IsTrue(element.To <= endTime, "element.To <= endTime");
                Assert.IsTrue(element.From < element.To, "Invalid a bar timestamp");
                data.Add(element);
            }

            this.dataFeed.Logon -= this.OnLogon;
            this.dataFeed.Stop();

            for (var index = 1; index < data.Count; ++index)
            {
                var first = data[index];
                var second = data[index - 1];
                Assert.IsTrue(first.To <= second.From, "Invalid bars sequence order.");
            }
        }
Exemplo n.º 13
0
        public void Tick(ConnectionStringBuilder builder)
        {
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Tick += this.OnTick;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");

            var symbols = new[] { "EURUSD" };
            this.dataFeed.Server.SubscribeToQuotes(symbols, 0);

            status = this.tickEvent.WaitOne(TickWaitingTimeout);
            Assert.IsTrue(status, "Timeout of tick event");

            this.dataFeed.Stop();
            this.dataFeed.Logon -= this.OnLogon;
            this.dataFeed.Tick -= this.OnTick;
        }
Exemplo n.º 14
0
        void IncorrectSubscribeToQuotes(ConnectionStringBuilder builder)
        {
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");

            try
            {
                this.dataFeed.Server.SubscribeToQuotes(null, 0);
                Assert.Fail("Null parameter has been accepted");
            }
            catch
            {
            }

            try
            {
                var symbols = new[] { "EURUSD" };
                this.dataFeed.Server.SubscribeToQuotes(symbols, -1);
                Assert.Fail("Negative parameter has been accepted");
            }
            catch
            {
            }

            try
            {
                var symbols = new[] { "EURUSD" };
                this.dataFeed.Server.SubscribeToQuotes(symbols, 6);
                Assert.Fail("Negative parameter has been accepted");
            }
            catch
            {
            }

            try
            {
                var symbols = new[] { "YYY/XXX" };
                this.dataFeed.Server.SubscribeToQuotes(symbols, 0);
                Assert.Fail("Invalid symbols have been accepted");
            }
            catch
            {
            }

            this.dataFeed.Stop();
            this.dataFeed.Logon -= this.OnLogon;
        }
Exemplo n.º 15
0
        void NotValidUsernameAndPasswordLogout(ConnectionStringBuilder builder)
        {
            var fixBuilder = builder as FixConnectionStringBuilder;
            fixBuilder.Username = "******";
            fixBuilder.Password = "******";
            fixBuilder.FixLogDirectory = "C:\\Temporary\\logs";

            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += OnLogon;
            this.dataFeed.Logout += OnLogout;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(!status, "Logon has been generated by error");

            status = this.logoutEvent.WaitOne(10 * LogoutWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logout event");
            if ("ext.0.0" == fixBuilder.ProtocolVersion)
            {
                Assert.IsTrue(LogoutReason.None == this.logoutReason);
            }
            else
            {
                Assert.IsTrue(LogoutReason.InvalidCredentials == this.logoutReason);
            }
            this.dataFeed.Stop();
            this.dataFeed.Logon -= OnLogon;
            this.dataFeed.Logout -= OnLogout;
        }
Exemplo n.º 16
0
 void GetQuotes(DataFeed feed)
 {
     foreach (var element in this.symbols)
     {
         this.GetQuotes(feed, element.Name);
     }
 }
Exemplo n.º 17
0
 void CreateAndDestroy(ConnectionStringBuilder builder)
 {
     var connectionString = builder.ToString();
     this.dataFeed = new DataFeed(connectionString);
 }
Exemplo n.º 18
0
 public BarsTimeIntervalEnumerator(DataFeed dataFeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
     : this(dataFeed, null, symbol, priceType, period, startTime, endTime, preferredBufferSize)
 {
 }
Exemplo n.º 19
0
 void Run(DataFeed feed)
 {
     this.CheckCancel();
     this.Log("Starting data feed");
     if (feed.Start(30000))
     {
         this.Log("Data feed is started");
         this.GetSymbols(feed);
         this.GetQuotes(feed);
     }
     else
     {
         this.Log("Couldn't start data feed");
     }
 }
Exemplo n.º 20
0
 void ThreadMethod(object obj)
 {
     try
     {
         var connectionString = (string)obj;
         this.Log("Creating data feed");
         using (var feed = new DataFeed(connectionString))
         {
             this.Log("Data feed is created");
             this.Run(feed);
             this.Log("Disposing data feed");
         }
         this.Log("Data feed is disposed");
     }
     catch(Exception ex)
     {
         this.Log(ex.Message);
     }
     this.Finish();
 }
Exemplo n.º 21
0
 void GetQuotes(DataFeed feed, string symbol)
 {
     this.CheckCancel();
     this.Log("Getting quotes for {0}", symbol);
     var bars = new PairBars(feed, symbol, BarPeriod.S1, timeStamp, -1);
     foreach (var element in bars)
     {
         if ((null != element.Bid) && (null != element.Ask))
         {
             var entry = new FullSymbolEntry(symbol)
             {
                 Bid = element.Bid.Close,
                 Ask = element.Ask.Close,
             };
             this.quotes.Add(entry);
             this.Log("Quotes for symbol {0} have been got: {1}/{2}", symbol, entry.Bid, entry.Ask);
         }
         else
         {
             this.Log("Quotes for symbol {0} are not available", symbol);
         }
         break;
     }
 }
Exemplo n.º 22
0
        void ForwardAndBackwardBarsEnumerationConsistency(ConnectionStringBuilder builder)
        {
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");


            var startTime = new DateTime(2011, 10, 10, 12, 0, 0, 0, DateTimeKind.Utc);
            var endTime = new DateTime(2011, 10, 10, 12, 1, 0, 0, DateTimeKind.Utc);


            var forwardBars = new Bars(this.dataFeed, "EURUSD", PriceType.Bid, BarPeriod.S1, startTime, endTime);
            var forwardData = forwardBars.ToList();

            var backwardBars = new Bars(this.dataFeed, "EURUSD", PriceType.Bid, BarPeriod.S1, endTime, startTime);
            var backwardData = backwardBars.ToList();

            var count = forwardData.Count;
            Assert.IsTrue(forwardData.Count == backwardData.Count, "forwardData.Count == backwardData.Count");
            for (var index = 0; index < count; ++index)
            {
                var first = forwardData[index];
                var second = backwardData[count - 1 - index];
                Assert.IsTrue(first.From == second.From);
                Assert.IsTrue(first.To == second.To);
            }
        }
Exemplo n.º 23
0
 public BarsCountEnumerator(DataFeed dataFeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int barsNumber, int preferredBufferSize)
     : this(dataFeed, null, symbol, priceType, period, startTime, barsNumber, preferredBufferSize)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 /// Creates a new Bars stream instance.
 /// If startTime is less or equal than endTime then this is forward bars enumeration (from past to future), otherwise this is backward enumeration (from future to past).
 /// Anyway all bars should be in the following time range: Min(startTime, endTime) &lt;= Bar.From and Bar.To &lt;= Max(startTime, endTime)
 /// </summary>
 /// <param name="datafeed">Datafeed instance; can not be null.</param>
 /// <param name="symbol">A required symbol; can not be null.</param>
 /// <param name="period">Bar period instance; can not be null.</param>
 /// <param name="startTime">A start time of bars enumeration.</param>
 /// <param name="endTime">A end time of bars enumeration.</param>
 /// <param name="preferredBufferSize">Bars enumeration requests bars from server by chunks. This is preferred chunk size. It should be positive.</param>
 /// <exception cref="System.ArgumentNullException">If datafeed, period or symbol is null.</exception>
 /// <exception cref="System.ArgumentOutOfRangeException">If preferredBufferSize is less than 2.</exception>
 public PairBars(DataFeed datafeed, string symbol, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
 {
     this.bids     = new Bars(datafeed, symbol, PriceType.Bid, period, startTime, endTime, preferredBufferSize);
     this.asks     = new Bars(datafeed, symbol, PriceType.Ask, period, startTime, endTime, preferredBufferSize);
     this.positive = DateTime.Compare(startTime, endTime) >= 0;
 }
Exemplo n.º 25
0
        public void SetupPathsAndConnect(string rootPath)
        {
            if (Initialized)
            {
                throw new InvalidOperationException("Fdk seems to be initialized for second time");
            }
            Initialized = true;


            // create and specify log directory
            string root;
            if (string.IsNullOrEmpty(rootPath))
            {
                var assembly = Assembly.GetEntryAssembly();
                root = assembly == null ? Directory.GetCurrentDirectory() : assembly.Location;
                root = Path.GetDirectoryName(root);
                if (root == null)
                    throw new InvalidDataException("FDK assembly's directory seems to be invalid");
            }
            else
            {
                root = rootPath;
            }
            var logsPath = Path.Combine(root, "Logs\\Fix");
            Directory.CreateDirectory(logsPath);

            Builder.FixLogDirectory = logsPath;

            Feed = new DataFeed(Builder.ToString()) { SynchOperationTimeout = 18000 };

            var storagePath = Path.Combine(root, "Storage");
            Directory.CreateDirectory(storagePath);

            Storage = new DataFeedStorage(storagePath, StorageProvider.Ntfs, Feed, true);
        }
Exemplo n.º 26
0
 protected DirectionalBarsEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int preferredBufferSize)
     : base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize)
 {
 }
Exemplo n.º 27
0
 public BarsCountEnumerator(DataFeed dataFeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int barsNumber, int preferredBufferSize)
     : this(dataFeed, null, symbol, priceType, period, startTime, barsNumber, preferredBufferSize)
 {
 }
Exemplo n.º 28
0
 /// <summary>
 /// Creates a new Bars stream instance.
 /// If startTime is less or equal than endTime then this is forward bars enumeration (from past to future), otherwise this is backward enumeration (from future to past).
 /// Anyway all bars should be in the following time range: Min(startTime, endTime) &lt;= Bar.From and Bar.To &lt;= Max(startTime, endTime)
 /// </summary>
 /// <param name="datafeed">DataFeed instance; can not be null.</param>
 /// <param name="symbol">A required symbol; can not be null.</param>
 /// <param name="priceType">A required price type: Bid or Ask.</param>
 /// <param name="period">Bar period instance; can not be null.</param>
 /// <param name="startTime">A start time of bars enumeration.</param>
 /// <param name="endTime">A end time of bars enumeration.</param>
 /// <param name="preferredBufferSize">Bars enumeration requests bars from server by chunks. This is preferred chunk size. It should be positive.</param>
 /// <exception cref="System.ArgumentNullException">If datafeed, period or symbol is null.</exception>
 /// <exception cref="System.ArgumentOutOfRangeException">If preferredBufferSize is less than 2.</exception>
 public Bars(DataFeed datafeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
 {
     ValidateArguments(datafeed, symbol, period, preferredBufferSize);
     this.enumerator = new BarsTimeIntervalEnumerator(datafeed, symbol, priceType, period, startTime, endTime, preferredBufferSize);
 }
Exemplo n.º 29
0
 void GetSymbols(DataFeed feed)
 {
     this.CheckCancel();
     this.Log("Getting symbols");
     this.symbols = feed.Server.GetSymbols();
     this.Log("{0} symbols have been got", this.symbols.Length);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Creates a new Bars stream instance.
 /// If barsNumber is less than zero then this is forward bars enumeration (from past to future), otherwise this is backward enumeration (from future to past).
 /// Anyway all bars should be in the following time range:
 ///		Bar.From &gt;= startTime for forward enumeration
 ///		Bar.To &lt;= startTime for backward enumeration
 /// </summary>
 /// <param name="datafeed">Datafeed instance; can not be null.</param>
 /// <param name="symbol">A required symbol; can not be null.</param>
 /// <param name="priceType">A required price type: Bid or Ask.</param>
 /// <param name="period">Bar period instance; can not be null.</param>
 /// <param name="startTime">A start time of bars enumeration.</param>
 /// <param name="barsNumber">Requested bars number; positive value means forward enumeration; negative value means backward enumeration.</param>
 /// <param name="preferredBufferSize">Bars enumeration requests bars from server by chunks. This is preferred chunk size. It should be positive.</param>
 /// <exception cref="System.ArgumentNullException">If datafeed, period or symbol is null.</exception>
 /// <exception cref="System.ArgumentOutOfRangeException">If preferredBufferSize is less than 2.</exception>
 public Bars(DataFeed datafeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int barsNumber, int preferredBufferSize)
 {
     ValidateArguments(datafeed, symbol, period, preferredBufferSize);
     this.enumerator = new BarsCountEnumerator(datafeed, symbol, priceType, period, startTime, barsNumber, preferredBufferSize);
 }
Exemplo n.º 31
0
 public BarsTimeIntervalEnumerator(DataFeed dataFeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime, int preferredBufferSize)
     : this(dataFeed, null, symbol, priceType, period, startTime, endTime, preferredBufferSize)
 {
 }
Exemplo n.º 32
0
 /// <summary>
 /// Creates a new Bars stream instance.
 /// If startTime is less or equal than endTime then this is forward bars enumeration (from past to future), otherwise this is backward enumeration (from future to past).
 /// Anyway all bars should be in the following time range: Min(startTime, endTime) &lt;= Bar.From and Bar.To &lt;= Max(startTime, endTime)
 /// </summary>
 /// <param name="datafeed">DataFeed instance; can not be null.</param>
 /// <param name="symbol">A required symbol; can not be null.</param>
 /// <param name="priceType">A required price type: Bid or Ask.</param>
 /// <param name="period">Bar period instance; can not be null.</param>
 /// <param name="startTime">A start time of bars enumeration.</param>
 /// <param name="endTime">A end time of bars enumeration.</param>
 /// <exception cref="System.ArgumentNullException">If datafeed, period or symbol is null.</exception>
 public Bars(DataFeed datafeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, DateTime endTime)
     : this(datafeed, symbol, priceType, period, startTime, endTime, DefaultBufferSize)
 {
 }
Exemplo n.º 33
0
        void Logon(ConnectionStringBuilder builder)
        {
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");

            var fixBuilder = builder as FixConnectionStringBuilder;
            if (fixBuilder != null)
            {
                var st = this.dataFeed.UsedProtocolVersion.ToString();
                Assert.IsTrue(fixBuilder.ProtocolVersion == st, "Server is not supported required protocol version");
            }
            this.dataFeed.Stop();
            this.dataFeed.Logon -= this.OnLogon;
        }
Exemplo n.º 34
0
 /// <summary>
 /// Creates a new Bars stream instance.
 /// If barsNumber is less than zero then this is forward bars enumeration (from past to future), otherwise this is backward enumeration (from future to past).
 /// Anyway all bars should be in the following time range:
 ///		Bar.From &gt;= startTime for forward enumeration
 ///		Bar.To &lt;= startTime for backward enumeration
 /// </summary>
 /// <param name="datafeed">Datafeed instance; can not be null.</param>
 /// <param name="symbol">A required symbol; can not be null.</param>
 /// <param name="priceType">A required price type: Bid or Ask.</param>
 /// <param name="period">Bar period instance; can not be null.</param>
 /// <param name="startTime">A start time of bars enumeration.</param>
 /// <param name="barsNumber">Requested bars number; positive value means forward enumeration; negative value means backward enumeration.</param>
 /// <exception cref="System.ArgumentNullException">If datafeed, period or symbol is null.</exception>
 public Bars(DataFeed datafeed, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int barsNumber)
     : this(datafeed, symbol, priceType, period, startTime, barsNumber, DefaultBufferSize)
 {
 }
Exemplo n.º 35
0
        void RegularLogout(ConnectionStringBuilder builder)
        {
            var fixBuilder = builder as FixConnectionStringBuilder;
            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Logout += this.OnLogout;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logon event");

            this.dataFeed.Stop();
            status = this.logoutEvent.WaitOne(0);
            Assert.IsTrue(status, "Timeout of logout event");

            this.dataFeed.Logon -= this.OnLogon;
            this.dataFeed.Logout -= this.OnLogout;
            Assert.IsTrue(LogoutReason.ClientInitiated == this.logoutReason);
        }
Exemplo n.º 36
0
 protected DirectionalBarsEnumerator(DataFeed dataFeed, IStorage storage, string symbol, PriceType priceType, BarPeriod period, DateTime startTime, int preferredBufferSize)
     : base(dataFeed, storage, symbol, priceType, period, startTime, preferredBufferSize)
 {
 }
Exemplo n.º 37
0
        void ConnectionErrorLogout(ConnectionStringBuilder builder)
        {
            var fixBuilder = builder as FixConnectionStringBuilder;
            fixBuilder.Address = "localhost";
            fixBuilder.FixLogDirectory = "C:\\Temporary\\Logs";

            var connectionString = builder.ToString();
            this.dataFeed = new DataFeed(connectionString);
            this.dataFeed.Logon += this.OnLogon;
            this.dataFeed.Logout += this.OnLogout;
            this.dataFeed.Start();

            var status = this.logonEvent.WaitOne(LogonWaitingTimeout);
            Assert.IsTrue(!status, "Logon has been generated by error");

            status = this.logoutEvent.WaitOne(10 * LogoutWaitingTimeout);
            Assert.IsTrue(status, "Timeout of logout event");
            Assert.IsTrue(LogoutReason.NetworkError == this.logoutReason);

            this.dataFeed.Stop();
            this.dataFeed.Logon -= this.OnLogon;
            this.dataFeed.Logout -= this.OnLogout;
        }