|
Hi,
I'm having trouble with Framework.AccountDataManager.GetSnapshot(4);
It is not returning all the positions I see in IB TWS. All the positions in TWS have been created throught the TWS gui and I am using ClientId=0, so they should definately appear. If you compare the two screenshots I've provided you will see my code below is not printing the AUD.CAD and AUD.JPY cfd positions.
IExecutionProvider provider = Framework.ProviderManager.GetExecutionProvider(MetaStrategy.ExecutionProvider.Id); provider.Connect(); while (!provider.IsConnected) { } AccountDataSnapshot accData = Framework.AccountDataManager.GetSnapshot(provider.Id);
foreach (AccountDataEntry entry in accData.Entries) { Console.WriteLine(entry.Account); AccountData[] positions = entry.Positions; foreach (AccountData position in positions) { Console.WriteLine(); Console.WriteLine($"{position}:"); foreach(AccountDataField accDataField in position.Fields) { Console.WriteLine($"{accDataField.Name}, {accDataField.Value}"); } } } }
Am I missing something?
| Attachments: |
File comment: This image shows that my code did not print all the positions.

AccountDataSnapshot.PNG [ 47.17 KiB | Viewed 52696 times ]
|
File comment: This image shows my positions in TWS.

tws.PNG [ 32.77 KiB | Viewed 52696 times ]
|
|