Hi,
I have a question about the TWS API.
What I need to do is to detect exactly when a new minutebars is avaliable which should be in the below scenario 23:13:00. So I have to request
a new minute bar for 23:13:00 for the 2 symbols below.(MSFT,IBM)
(0)20110416 23:12:22,22.83
(0)20110416 23:13:00,22.84
(0)finished-20110416 23:12:22-20110416 23:13:22,-1
(1)20110416 23:12:22,160.3
(1)20110416 23:13:00,160.3
(1)finished-20110416 23:12:22-20110416 23:13:22,-1
Now I can just click button1 and when I do that I get the below lines.
My questions are:
1. Why do I receive 3 lines per symbol? I beleive I only are interested in: 23:13:00,22.84 ?
Because I dont want to request 3 lines as it is unnessecary(BandWidth and request limitations, is it possible to only request the line I need?)
2. Later I will need to request 500 symbols at the same time. I know that the TWS API has a limit of 100 realtime symbols(Tick data).
But this should be a historical request which means practically that I will request 500 symbols last minute data perheps 1 millisecond after
it is avaliable.
How can I do this the best way with the avaliable events in the TWS API?
I will be very happy for any assitance. Thank you!
I have a question about the TWS API.
What I need to do is to detect exactly when a new minutebars is avaliable which should be in the below scenario 23:13:00. So I have to request
a new minute bar for 23:13:00 for the 2 symbols below.(MSFT,IBM)
(0)20110416 23:12:22,22.83
(0)20110416 23:13:00,22.84
(0)finished-20110416 23:12:22-20110416 23:13:22,-1
(1)20110416 23:12:22,160.3
(1)20110416 23:13:00,160.3
(1)finished-20110416 23:12:22-20110416 23:13:22,-1
Now I can just click button1 and when I do that I get the below lines.
My questions are:
1. Why do I receive 3 lines per symbol? I beleive I only are interested in: 23:13:00,22.84 ?
Because I dont want to request 3 lines as it is unnessecary(BandWidth and request limitations, is it possible to only request the line I need?)
2. Later I will need to request 500 symbols at the same time. I know that the TWS API has a limit of 100 realtime symbols(Tick data).
But this should be a historical request which means practically that I will request 500 symbols last minute data perheps 1 millisecond after
it is avaliable.
How can I do this the best way with the avaliable events in the TWS API?
I will be very happy for any assitance. Thank you!
Code:
private AxTWSLib.AxTws Tws1;
private void button3_Click(object sender, EventArgs e)
{
//Connect to TWS
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);
//How to Request 1 minute bars for those 2 JUST WHEN a new update is avaliable?
Tws1.reqHistoricalData(0, "MSFT", "STK", "", 0, "", "", "SMART", "USD", 0, "", "60 S", "1 min", "TRADES", 1, 1);
Tws1.reqHistoricalData(1, "IBM", "STK", "", 0, "", "", "SMART", "USD", 0, "", "60 S", "1 min", "TRADES", 1, 1);
Tws1.historicalData -= new AxTWSLib._DTwsEvents_historicalDataEventHandler(this.historicalData22);//Delete current memory before filling
Tws1.historicalData += new AxTWSLib._DTwsEvents_historicalDataEventHandler(this.historicalData22);
}
private void historicalData22(object sender, AxTWSLib._DTwsEvents_historicalDataEvent e)
{
String getInfo = "(" + e.reqId + ")" + e.date + "," + e.close;
listBox1.Items.Add(getInfo);
}