Ejemplo n.º 1
0
        static void TestASTSSingleConnection()
        {
            IAlarmable alarmer = new StubAlarmer();
            IDealingServerForASTSConnector dealingServer = new CASTSDealingServer(/*alarmer*/);
            IStockConnector stockConnector = new CASTSConnectorSingle(dealingServer);
            int             botId          = 100;

            //Thread.Sleep(10000);
            //stockConnector.AddOrder(botId, "AFLT", 157.70M, EnmOrderDir.Buy, 1);
            //stockConnector.CancelOrder(2064814799, botId);
            //stockConnector.CancelOrder(2064814740, botId);

            CUtil.ThreadStart(new Action(() =>
            {
                Thread.Sleep(20000);
                stockConnector.DisconnectFromServer();
            }
                                         ));


            while (true)
            {
                Thread.Sleep(60000);
            }
        }
        /*
         * void ButtOkOrNot_Click(object sender, RoutedEventArgs e)
         * {
         *  //throw new NotImplementedException();
         *  FORTSStatusWindow wfs = new FORTSStatusWindow();
         *  wfs.WindowStartupLocation = WindowStartupLocation.CenterScreen;
         *  wfs.ControlFORTSStatus.BindButtons((object)Plaza2Connector.GUIBox);
         *  m_mainWindow.DummyButton.Focus();
         *  wfs.ShowDialog();
         *
         * }
         *
         * private bool RetrieveInstTF(string buttName, ref string isin, ref  string tf, ref string stDt)
         * {
         *
         *  Regex reg = new Regex(@"([\w0-9\-\.]+)_([\w0-9]+)");
         *  Match m = reg.Match(buttName);
         *  if (m.Groups.Count > 2)
         *  {
         *      isin = Convert.ToString(m.Groups[1]);
         *      tf = Convert.ToString(m.Groups[2]);
         *
         *      DateTime dt = Plaza2Connector.ServerTime;
         *
         *      stDt = CUtilTime.NormalizeDay(dt).ToString();
         *      return true;
         *  }
         *
         *  return false;
         * }
         *
         *
         *
         *
         *
         */



        private void ThreadFunc()
        {
            //Plaza2Connector = new CPlaza2Connector();
            _dealingServer = new CASTSDealingServer();
            _dealingServer.PasswordChangeReply = OnPasswordChangeReply;
            _dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(BindData));

            _dealingServer.Process();


            // Plaza2Connector.Process();
        }
Ejemplo n.º 3
0
        static void TestASTSDealingServer()
        {
            IAlarmable         alarmer       = new StubAlarmer();
            CASTSDealingServer dealingServer = new CASTSDealingServer(/*alarmer*/);

            dealingServer.Process();



            while (true)
            {
                Thread.Sleep(100);
            }
        }
Ejemplo n.º 4
0
        static void TestASTSDoubleConnection()
        {
            IAlarmable alarmer = new StubAlarmer();
            IDealingServerForASTSConnector dealingServer = new CASTSDealingServer(/*alarmer*/);
            IStockConnector stockConnector = new CASTSConnectorDouble(dealingServer);
            int             botId          = 100;

            Thread.Sleep(10000);
            //stockConnector.AddOrder(botId, "AFLT", 157.70M, EnmOrderDir.Buy, 1);
            //stockConnector.AddOrder(botId, "AFLT", 157.80M, EnmOrderDir.Buy, 1);
            stockConnector.CancelOrder(2063436210, botId);
            stockConnector.CancelOrder(2063436211, botId);


            while (true)
            {
                Thread.Sleep(0);
            }
        }