Posted 5/31/2009 18:30:03
|
|
|
|
How do I can 'read' from RE program the IB's account live pending orders and live portfolio?
I have test the following in the Startup() method, but that write nothing in the file, although I have cca 15 pending IB positions and RE with Live System works properly. 
public override void Startup()
{
// Perform initialization here.
String filename;
String s="";
filename="c:/Temp/OpenPos.csv";
using (StreamWriter sw = new StreamWriter(filename)) {
sw.WriteLine("Size;EntryPrice;Symbol");
foreach (Position oo in this.PositionManager.GetOpenPositions()) {
s=""+oo.CurrentSize+";"+oo.EntryPrice+";"+oo.Symbol;
sw.WriteLine(s);
}
sw.WriteLine("All done!");
}
}
Can everybody post a sample code with the solution.
Thanks a lot.
Hali
|
|
Posted 6/1/2009 07:38:28
|
|
|
|
This isn't really something we support. And if you're referring to open positions/orders that are currently in play while the system is running, those are not accessible from a file. There is a file called OpenPositions.xml that we persist between sessions. You could parse this yourself to pick up information, but OpenPositions.xml is processed by RightEdge before Startup() is called.
RLHali (5/31/2009)
How do I can 'read' from RE program the IB's account live pending orders and live portfolio?
I have test the following in the Startup() method, but that write nothing in the file, although I have cca 15 pending IB positions and RE with Live System works properly. 
public override void Startup()
{
// Perform initialization here.
String filename;
String s="";
filename="c:/Temp/OpenPos.csv";
using (StreamWriter sw = new StreamWriter(filename)) {
sw.WriteLine("Size;EntryPrice;Symbol");
foreach (Position oo in this.PositionManager.GetOpenPositions()) {
s=""+oo.CurrentSize+";"+oo.EntryPrice+";"+oo.Symbol;
sw.WriteLine(s);
}
sw.WriteLine("All done!");
}
}
Can everybody post a sample code with the solution.
Thanks a lot.
Hali
|
|
Posted 6/1/2009 09:11:16
|
|
|
|
|
|
Posted 6/23/2009 23:23:44
|
|
|
|
Bill, I am curious to know how once RE has recovered its position and order state from OpenPositions.xml, RE then matches up and "Broker Side" order IDs.
By this I mean, what handles (IDs) does it use to manage those orders at the broker. Is there another dictionary mapping RE IDs to Broker IDs or is there a mapping function that can always generate a Broker ID from an RE ID?
|
|
Posted 6/24/2009 07:53:33
|
|
|
|
Yes, there's a mapping between the two. If you're looking at the RightEdge TWS plugin source code, the variable is a Dictionary named openOrders.
smersh (6/23/2009) Bill, I am curious to know how once RE has recovered its position and order state from OpenPositions.xml, RE then matches up and "Broker Side" order IDs.
By this I mean, what handles (IDs) does it use to manage those orders at the broker. Is there another dictionary mapping RE IDs to Broker IDs or is there a mapping function that can always generate a Broker ID from an RE ID?
|
|
|
|