public void Execute(IExampleInterface app)
        {
            this.app = app;
            Console.WriteLine("Waiting for connections on port " + PORT);

            IndicatorServer server = new IndicatorServer();
            server.AddListener(this);

            server.AddIndicatorFactory(new MyFactory());

            server.Start();
        }
        public void Execute(IExampleInterface app)
        {
            _app = app;
            Console.WriteLine(@"Waiting for connections on port " + Port);

            var server = new IndicatorServer();
            server.AddListener(this);

            server.AddIndicatorFactory(new MyFactory());

            server.Start();
            server.WaitForShutdown();
        }
Exemple #3
0
 /// <summary>
 /// Construct an indicator link.
 /// </summary>
 /// <param name="node">The parent server.</param>
 /// <param name="s">The socket. (client)</param>
 public IndicatorLink(IndicatorServer node, Socket s)
 {
     try
     {
         _currentPosition       = 0;
         _actualSize            = 0;
         _parentServer          = node;
         s.Blocking             = true;
         _socket                = s;
         _socket.ReceiveTimeout = SocketTimeout;
     }
     catch (IOException ex)
     {
         throw new IndicatorError(ex);
     }
 }
        public void Execute(IExampleInterface app)
        {
            this.app = app;

            Console.WriteLine("Waiting for connections on port " + PORT);

            DownloadIndicatorFactory ind = new DownloadIndicatorFactory(new FileInfo("d:\\ninja.csv"));
            ind.RequestData("HIGH[5]");
            ind.RequestData("LOW[1]");
            ind.RequestData("OPEN[1]");
            ind.RequestData("CLOSE[1]");
            ind.RequestData("VOL[1]");
            ind.RequestData("MACD(12,26,9).Avg[1]");

            IndicatorServer server = new IndicatorServer();
            server.AddListener(this);
            server.AddIndicatorFactory(ind);
            server.Start();
            server.WaitForIndicatorCompletion();
        }
 /// <summary>
 /// Construct a client handler. 
 /// </summary>
 /// <param name="s">The indicator server.</param>
 /// <param name="l">The indicator link.</param>
 public HandleClient(IndicatorServer s, IndicatorLink l)
 {
     RemoteType = "Unknown";
     Link = l;
     _server = s;
 }
Exemple #6
0
 /// <summary>
 /// Construct a client handler.
 /// </summary>
 /// <param name="s">The indicator server.</param>
 /// <param name="l">The indicator link.</param>
 public HandleClient(IndicatorServer s, IndicatorLink l)
 {
     RemoteType = "Unknown";
     Link       = l;
     _server    = s;
 }
 /// <summary>
 /// Construct an indicator link. 
 /// </summary>
 /// <param name="node">The parent server.</param>
 /// <param name="s">The socket. (client)</param>
 public IndicatorLink(IndicatorServer node, Socket s)
 {
     try
     {
         this.currentPosition = 0;
         this.actualSize = 0;
         this.parentServer = node;
         this.socket = s;
         this.socket.ReceiveTimeout = SOCKET_TIMEOUT;
     }
     catch (IOException ex)
     {
         throw new IndicatorError(ex);
     }
 }
 /// <summary>
 /// Construct an indicator link. 
 /// </summary>
 /// <param name="node">The parent server.</param>
 /// <param name="s">The socket. (client)</param>
 public IndicatorLink(IndicatorServer node, Socket s)
 {
     try
     {
         _currentPosition = 0;
         _actualSize = 0;
         _parentServer = node;
         s.Blocking = true;
         _socket = s;
         _socket.ReceiveTimeout = SocketTimeout;
     }
     catch (IOException ex)
     {
         throw new IndicatorError(ex);
     }
 }
        /// <summary>
        /// Run the indicator in either collection or indicator mode. 
        /// </summary>
        /// <param name="collectMode">True to run the indicator in collection mode,
        /// false otherwise.</param>
        public void Run(bool collectMode)
        {
            IMLRegression method;

            if (collectMode)
            {
                method = null;
                Console.WriteLine(@"Ready to collect data from remote indicator.");
            }
            else
            {
                method =
                    (IMLRegression)
                    EncogDirectoryPersistence.LoadObject(FileUtil.CombinePath(new FileInfo(_path), Config.MethodName));
                Console.WriteLine(@"Indicator ready.");
            }

            Console.WriteLine(@"Waiting for connections on port " + Port);

            var server = new IndicatorServer();
            server.AddListener(this);

            server.AddIndicatorFactory(new MyFactory(method, _path));
            server.Start();

            if (collectMode)
            {
                server.WaitForIndicatorCompletion();
            }
            else
            {
                server.WaitForShutdown();
            }
        }