/// <summary>
        /// Initializes a new instance of the <see cref="TwsControllerBase"/> class.
        /// </summary>
        /// <param name="clientSocket">The client socket</param>
        /// <param name="twsCallbackHandler">The callback handler</param>
        /// <param name="host">The host</param>
        /// <param name="port">The port</param>
        /// <param name="clientId">The client id</param>
        public TwsControllerBase(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler, string host, int port, int clientId)
        {
            this.clientSocket       = clientSocket;
            this.twsCallbackHandler = twsCallbackHandler;
            this.host     = host;
            this.port     = port;
            this.clientId = clientId;

            this.accountUpdates        = new ConcurrentDictionary <string, string>();
            this.signal                = new EReaderMonitorSignal();
            this.twsRequestIdGenerator = new TwsRequestIdGenerator();

            // Some events come in unrequested, this will subscribe before the connection is created
            this.twsCallbackHandler.NextValidIdEvent        += this.OnNextValidId;
            this.twsCallbackHandler.UpdateAccountValueEvent += this.OnUpdateAccountValueEvent;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsExecutionController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS callback handler</param>
 /// <param name="twsRequestIdGenerator">The TWS request ID generator</param>
 public TwsExecutionController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler, ITwsRequestIdGenerator twsRequestIdGenerator)
 {
     this.clientSocket          = clientSocket;
     this.twsCallbackHandler    = twsCallbackHandler;
     this.twsRequestIdGenerator = twsRequestIdGenerator;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsSecurityDefinitionOptionParametersController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS wrapper implementation</param>
 /// <param name="twsRequestIdGenerator">The TWS request Id generator</param>
 public TwsSecurityDefinitionOptionParametersController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler, ITwsRequestIdGenerator twsRequestIdGenerator)
 {
     this.clientSocket          = clientSocket;
     this.twsCallbackHandler    = twsCallbackHandler;
     this.twsRequestIdGenerator = twsRequestIdGenerator;
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsHistoricalDataController"/> class.
 /// </summary>
 /// <param name="clientSocket">The client socket</param>
 /// <param name="twsCallbackHandler">The callback handler</param>
 /// <param name="twsRequestIdGenerator">The request Id generator</param>
 public TwsHistoricalDataController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler, ITwsRequestIdGenerator twsRequestIdGenerator)
 {
     this.clientSocket          = clientSocket;
     this.twsCallbackHandler    = twsCallbackHandler;
     this.twsRequestIdGenerator = twsRequestIdGenerator;
 }