Example #1
0
    public IBGridForm(string[] args)
    {
      _twsHost = "localhost";
      _twsPort = 7496;

     
      InitializeComponent();

      _grids = new List<Grid>();
      _grids.Add(stocksGrid);
      _grids.Add(futuresGrid);
      _grids.Add(indicesGrid);
      _grids.Add(stockOptionsGrid);
      _grids.Add(futureOptionsGrid);
      _grids.Add(indexOptionsGrid);

      stocksGrid.Tag = IBSecurityType.Stock;
      futuresGrid.Tag = IBSecurityType.Future;
      indicesGrid.Tag = IBSecurityType.Index;
      stockOptionsGrid.Tag = IBSecurityType.Option;
      futureOptionsGrid.Tag = IBSecurityType.FutureOption;
      indexOptionsGrid.Tag = IBSecurityType.Option;

      SetupCommonGridResources();
      SetupMarketDataGrids();
      SetupLogGrid();

      _settings = new TWSClientSettings();

      _instruments = new RecordedInstruments();

      _logFiles = new Dictionary<string, TextWriter>();

      _logGridRow = 1;

      _updateGridRowDelegate = UpdateGridRow;

      ParseCommandLine(args);
    }
Example #2
0
    /// <summary>
    /// Construct a new TWSClient object for connecting to IB's Trader WorkStation
    /// </summary>
    public TWSClient()
    {
      _tcpClient = null;
      _stream = null;
      _thread = null;
      Status = TWSClientStatus.Unknown;
      _twsTime = String.Empty;
      _nextValidId = 0;

      _orderIds = new Dictionary<string, int>();

      ClientInfo = new TWSClientInfo();

      NUMBER_DECIMAL_SEPARATOR = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator;
      EndPoint = new IPEndPoint(new IPAddress(new byte[] {127, 0, 0, 1}), DEFAULT_PORT);

      _settings = new TWSClientSettings();
    }