public override void FixtureSetup()
 {
     base.FixtureSetup();
     // hmmmm... only one fixture setup allowed.
     _rpcClient       = BuildRpcClient();
     _streamingClient = _rpcClient.CreateStreamingClient();
     _CFDmarketId     = MarketFixture.GetAvailableCFDMarkets(_rpcClient)[0].MarketId;
     _accounts        = _rpcClient.AccountInformation.GetClientAndTradingAccount();
 }
 public override void FixtureSetup()
 {
     base.FixtureSetup();
     // hmmmm... only one fixture setup allowed. 
     _rpcClient = BuildRpcClient();
     _streamingClient = _rpcClient.CreateStreamingClient();
     _CFDmarketId = MarketFixture.GetAvailableCFDMarkets(_rpcClient)[0].MarketId;
     _accounts = _rpcClient.AccountInformation.GetClientAndTradingAccount();
 }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (_streamingClient != null)
            {
                try
                {
                    _listener.Stop();

                    _streamingClient.Disconnect();
                }
                catch
                {

                    // swallow
                }
                _listener = null;
                _streamingClient = null;
            }
            if (_rpcClient != null)
            {
                try
                {
                    _rpcClient.LogOut();
                }
                catch
                {

                    // swallow
                }

                _streamingClient = null;

            }
            var settingsForm = new Settings();
            settingsForm.ShowDialog();
            if (settingsForm.StreamingClient == null)
            {
                return;
                MessageBox.Show("Not connected");
            }
            _streamingClient = settingsForm.StreamingClient;
            _listener = _streamingClient.BuildPricesListener(int.Parse(MarketIdTextBox.Text));
            _listener.MessageReceived += new EventHandler<MessageEventArgs<PriceDTO>>(ListenerMessageReceived);
            _listener.Start();
            _rpcClient = settingsForm.RpcClient;
            _logic = new TradingRobot.Logic.SimpleBuyLowSellHigh(_rpcClient);
            _logic.BidPrice = SellNUD.Value;
            _logic.OfferPrice = BuyNUD.Value;
            _logic.Quantity = QuantityNUD.Value;
            MessageBox.Show("Connected");

        }
Example #4
0
        private void BuildClients()
        {
            Dispatcher.BeginInvoke(() => listBox1.Items.Add("creating rpc client"));
            RpcClient = new Client(RPC_URI, STREAM_URI, "CI-WP7");
            RpcClient.BeginLogIn(USERNAME, PASSWORD, ar =>
            {
                var session = RpcClient.EndLogIn(ar);

                ThreadPool.QueueUserWorkItem(_ =>
                {
                    Dispatcher.BeginInvoke(() => listBox1.Items.Add("creating listeners"));
                    StreamingClient = RpcClient.CreateStreamingClient();
                    MarketPricesStream = StreamingClient.BuildDefaultPricesListener(AccountOperatorId);
                    MarketPricesStream.MessageReceived += OnMarketPricesStreamMessageReceived;
                    Dispatcher.BeginInvoke(() => button1.IsEnabled = true);
                });
            }, null);
        }
Example #5
0
        private void BuildClients()
        {
            Dispatcher.BeginInvoke(() => listBox1.Items.Add("creating rpc client"));
            RpcClient = new Client(RPC_URI, STREAM_URI, "CI-WP7");
            RpcClient.BeginLogIn(USERNAME, PASSWORD, ar =>
            {
                var session = RpcClient.EndLogIn(ar);

                ThreadPool.QueueUserWorkItem(_ =>
                {
                    Dispatcher.BeginInvoke(() => listBox1.Items.Add("creating listeners"));
                    StreamingClient    = RpcClient.CreateStreamingClient();
                    MarketPricesStream = StreamingClient.BuildDefaultPricesListener(AccountOperatorId);
                    MarketPricesStream.MessageReceived            += OnMarketPricesStreamMessageReceived;
                    Dispatcher.BeginInvoke(() => button1.IsEnabled = true);
                });
            }, null);
        }