Esempio n. 1
0
 public virtual void OnMarketDepthCancel(TWSServerClientState client, int reqId, IBContract contract)
 {
     if (MarketDataCancel != null)
     {
         MarketDataCancel(this, new TWSMarketDataCancelEventArgs(client, reqId, contract));
     }
 }
Esempio n. 2
0
 public virtual void OnMarketDataRequest(TWSServerClientState client, int reqId, IBContract contract)
 {
     if (MarketDataRequest != null)
     {
         MarketDataRequest(this, new TWSMarketDataRequestEventArgs(client, reqId, contract));
     }
 }
Esempio n. 3
0
        public virtual void OnTcpClientConnect(IAsyncResult asyn)
        {
            if (TcpClientConnected != null)
            {
                TcpClientConnected(this, new TWSTcpClientConnectedEventArgs(this, null));
            }
            try
            {
                // Here we complete/end the BeginAccept() asynchronous call
                // by calling EndAccept() - which returns the reference to
                // a new Socket object
                TcpClient tc = _listener.EndAcceptTcpClient(asyn);
                _clientCount++;
                var s = new BufferedReadStream(tc.GetStream(), DEFAULT_BUFFER_SIZE);
                TWSServerClientState connection = new TWSServerClientState(this, s);

                lock (_clients) {
                    _clients.Add(connection);
                }

                connection.Start();

                // Since the main Socket is now free, it can go back and wait for
                // other clients who are attempting to connect
                _listener.BeginAcceptTcpClient(_connectCallback, null);
            }
            catch (ObjectDisposedException)
            {
                System.Diagnostics.Debugger.Log(0, "1", "\n OnClientConnection: Socket has been closed\n");
            }
            catch (SocketException se)
            {
                OnError(new TWSError(TWSErrors.NO_VALID_CODE, se.Message));
            }
        }
Esempio n. 4
0
 public virtual void OnLogin(TWSServerClientState clientState, TWSClientInfo clientInfo, TWSClientId clientId)
 {
     if (Login != null)
     {
         Login(this, new TWSServerEventArgs(clientState));
     }
 }
Esempio n. 5
0
 public virtual void OnMarketDepthRequest(TWSServerClientState clientState, int reqId, IBContract contract, int numRows)
 {
     if (MarketDepthRequest != null)
     {
         MarketDepthRequest(this, new TWSMarketDepthRequestEventArgs(clientState, reqId, contract, numRows));
     }
 }
Esempio n. 6
0
 public virtual void OnTWSClientConnect(TWSServerClientState client, int clientId)
 {
 }
Esempio n. 7
0
 public TWSMarketDataCancelEventArgs(TWSServerClientState clientState, int reqId, IBContract contract)
     : base(clientState)
 {
     Contract = contract;
     ReqId    = reqId;
 }
Esempio n. 8
0
 public TWSServerEventArgs(TWSServerClientState clientState)
 {
     ClientState = clientState;
     Server = clientState.Server;
 }
Esempio n. 9
0
 public TWSMarketDepthRequestEventArgs(TWSServerClientState clientState, int reqId, IBContract contract, int numRows)
     : base(clientState, reqId, contract)
 {
     numRows = numRows;
 }
Esempio n. 10
0
 public virtual void OnMarketDataRequest(TWSServerClientState client, int reqId, IBContract contract)
 {
     if (MarketDataRequest != null)
         MarketDataRequest(this, new TWSMarketDataRequestEventArgs(client, reqId, contract));
 }
Esempio n. 11
0
 public virtual void OnLogin(TWSServerClientState clientState, TWSClientInfo clientInfo, TWSClientId clientId)
 {
     if (Login != null)
         Login(this, new TWSServerEventArgs(clientState));
 }
Esempio n. 12
0
 public virtual void OnContractDetailsRequest(TWSServerClientState client, IBContract contract)
 {
 }
Esempio n. 13
0
        private void Init()
        {
            _reader = new BinaryReader(_logStream);

            // Make sure the playback process doesn't write
            // anything into the playback stream
            _enc = new NullEncoding(_logStream);

            _loopbackServer = new TWSLoopbackServer(_logStream);
            _loopbackServer.Login += new EventHandler<TWSServerEventArgs>(LoopbackServer_Login);
            _loopbackServer.MarketDataRequest +=
                new EventHandler<TWSMarketDataRequestEventArgs>(LoopbackServer_MarketDataRequest);
            _loopbackServer.MarketDepthCancel +=
                new EventHandler<TWSMarketDataCancelEventArgs>(LoopbackServer_MarketDepthCancel);
        }
Esempio n. 14
0
 public TWSServerErrorEventArgs(TWSServerClientState clientState, TWSError error)
     : base(clientState)
 {
     Error = error;
 }
Esempio n. 15
0
 public TWSServerEventArgs(TWSServerClientState clientState)
 {
     ClientState = clientState;
     Server      = clientState.Server;
 }
Esempio n. 16
0
 public virtual void OnContractDetailsRequest(TWSServerClientState client, IBContract contract)
 {
 }
Esempio n. 17
0
 public virtual void OnMarketDepthCancel(TWSServerClientState client, int reqId, IBContract contract)
 {
     if (MarketDataCancel != null)
         MarketDataCancel(this, new TWSMarketDataCancelEventArgs(client, reqId, contract));
 }
Esempio n. 18
0
 public virtual void OnMarketDepthRequest(TWSServerClientState clientState, int reqId, IBContract contract, int numRows)
 {
     if (MarketDepthRequest != null)
         MarketDepthRequest(this, new TWSMarketDepthRequestEventArgs(clientState, reqId, contract, numRows));
 }
Esempio n. 19
0
        public virtual void OnTcpClientConnect(IAsyncResult asyn)
        {
            if (TcpClientConnected != null)
                TcpClientConnected(this, new TWSTcpClientConnectedEventArgs(this, null));
            try
            {
                // Here we complete/end the BeginAccept() asynchronous call
                // by calling EndAccept() - which returns the reference to
                // a new Socket object
                TcpClient tc = _listener.EndAcceptTcpClient(asyn);
                _clientCount++;
                var s = new BufferedReadStream(tc.GetStream(), DEFAULT_BUFFER_SIZE);
                TWSServerClientState connection = new TWSServerClientState(this, s);

                lock (_clients) {
                    _clients.Add(connection);
                }

                connection.Start();

                // Since the main Socket is now free, it can go back and wait for
                // other clients who are attempting to connect
                _listener.BeginAcceptTcpClient(_connectCallback, null);
            }
            catch (ObjectDisposedException)
            {
                System.Diagnostics.Debugger.Log(0, "1", "\n OnClientConnection: Socket has been closed\n");
            }
            catch (SocketException se)
            {
                OnError(new TWSError(TWSErrors.NO_VALID_CODE, se.Message));
            }
        }
Esempio n. 20
0
 public TWSServerErrorEventArgs(TWSServerClientState clientState, TWSError error)
     : base(clientState)
 {
     Error = error;
 }
Esempio n. 21
0
 public virtual void OnTWSClientConnect(TWSServerClientState client, int clientId)
 {
 }
Esempio n. 22
0
 public TWSMarketDataRequestEventArgs(TWSServerClientState clientState, int reqId, IBContract contract)
     : base(clientState)
 {
     Contract = contract;
     ReqId = reqId;
 }
Esempio n. 23
0
 public TWSMarketDepthRequestEventArgs(TWSServerClientState clientState, int reqId, IBContract contract, int numRows)
     : base(clientState, reqId, contract)
 {
     numRows = numRows;
 }