/// <summary>
 /// Initializes a new instance of the <see cref="TwsAccountUpdatesController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS callback handler</param>
 public TwsAccountUpdatesController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
     this.accountUpdates     = new ConcurrentDictionary <string, string>();
     this.twsCallbackHandler.UpdateAccountValueEvent += this.OnUpdateAccountValueEvent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsConnectionController"/> class.
 /// Controls the connection to TWS.
 /// </summary>
 /// <param name="clientSocket">The client socket</param>
 /// <param name="twsCallbackHandler">The callback handler</param>
 /// <param name="host">The host name</param>
 /// <param name="port">The port</param>
 /// <param name="clientId">The client ID, see TWS docs</param>
 public TwsConnectionController(
     ITwsClientSocket clientSocket,
     ITwsCallbackHandler twsCallbackHandler,
     string host,
     int port,
     int clientId)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
     this.signal             = new EReaderMonitorSignal();
     this.host      = host;
     this.port      = port;
     this.clientId  = clientId;
     this.connected = false;
 }
        /// <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;
        }
Beispiel #4
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="TwsNextOrderIdController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS callback handler</param>
 public TwsNextOrderIdController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
     this.twsCallbackHandler.NextValidIdEvent += this.OnNextValidId;
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsOrderPlacementController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS wrapper implementation</param>
 public TwsOrderPlacementController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
 }
 /// <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;
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsPositionsController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS callback handler</param>
 public TwsPositionsController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
 }
Beispiel #9
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;
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsNewsProvidersController"/> class.
 /// </summary>
 /// <param name="clientSocket">The client socket</param>
 /// <param name="twsCallbackHandler">The callback handler</param>
 public TwsNewsProvidersController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TwsOrderCancelationController"/> class.
 /// </summary>
 /// <param name="clientSocket">The TWS client socket</param>
 /// <param name="twsCallbackHandler">The TWS callback handler</param>
 public TwsOrderCancelationController(ITwsClientSocket clientSocket, ITwsCallbackHandler twsCallbackHandler)
 {
     this.clientSocket       = clientSocket;
     this.twsCallbackHandler = twsCallbackHandler;
 }