Hi
I need to store my positions so that when my application starts up it can load the existing positions. The code I use is:
Код
var dataPath = @"Data\" + _connectorAccount.AccountName;
_entityRegistry = new CsvEntityRegistry(dataPath);
_storageRegistry = new StorageRegistry
{
DefaultDrive = new LocalMarketDataDrive(dataPath)
};
_connector.InitializeStorage(_entityRegistry, _storageRegistry);
_entityRegistry.Init();
_connector.StorageAdapter.DaysLoad = DateTime.Now.Subtract(_connectorAccount.StartTrading.Value);
_connector.StorageAdapter.Format = StorageFormats.Csv;
_connector.StorageAdapter.Load();
The problem is that when I connect to TWS, I get the following error message:
Message 'Connect,T(L)=2017/11/06 21:25:31.278,Error=At least one connection should be made.' caused processing error.
with inner exception message:
The given key was not present in the dictionary.
and inner exception stack trace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Ecng.Collections.SynchronizedDictionary`2.get_Item(TKey key)
at StockSharp.Algo.Connector.ProcessConnectMessage(BaseConnectionMessage message)
at StockSharp.Algo.Connector.OnProcessMessage(Message message)