UniversalGoldmine
Junior member
- Messages
- 26
- Likes
- 0
I am trying to request realtime data with IB API.
What I want to request is the Real-Time values of the Daily Bar:
* Close
* Net Change
* Bid
* Ask
* High
* Low
* Todays Volume
I have begun some code but are not sure how to complete it for MSFT in this example. I know that I will need to call an event.
I have tried to set it up like in the code below, but the close value does not appear in the ListBox. I wonder what I can be missing out ?
Thank you...
What I want to request is the Real-Time values of the Daily Bar:
* Close
* Net Change
* Bid
* Ask
* High
* Low
* Todays Volume
I have begun some code but are not sure how to complete it for MSFT in this example. I know that I will need to call an event.
I have tried to set it up like in the code below, but the close value does not appear in the ListBox. I wonder what I can be missing out ?
Thank you...
Code:
private AxTWSLib.AxTws Tws1;
Tws1 = new AxTWSLib.AxTws();
Tws1.BeginInit();
Tws1.Enabled = true;
Tws1.Location = new System.Drawing.Point(32, 664);
Tws1.Name = "Tws1";
Controls.Add(Tws1);
Tws1.EndInit();
Tws1.connect("127.0.0.1", 7496, 0);
Tws1.reqRealTimeBars(1, "MSFT", "STK", "", 0, "", "", "SMART", "", "USD", 0, 5, "TRADES", 1);
Tws1.realtimeBar += new AxTWSLib._DTwsEvents_realtimeBarEventHandler(this.realtimeBar);
private void realtimeBar(object sender, AxTWSLib._DTwsEvents_realtimeBarEvent e)
{
String msg = e.close.ToString();
listBox1.Items.Add(msg);
}
Last edited: