storageregistry. StockSharphttps://stocksharp.com/handlers/atom.ashx?category=tag&id=storageregistry&type=communityCopyright @ StockSharp Platform LLC 2010 - 20242024-03-29T08:50:42Zhttps://stocksharp.com/images/logo.pnghttps://stocksharp.com/topic/8797/Storing positions2017-11-06T22:30:01Z2017-12-18T10:16:31ZJohan Kirstenhttps://stocksharp.com/users/99799/info@stocksharp.comHi<br /><br />I need to store my positions so that when my application starts up it can load the existing positions. The code I use is:<br /><br /><div class="code"><strong>Code</strong><div class="innercode"><br />var dataPath = @"Data\" + _connectorAccount.AccountName;<br />_entityRegistry = new CsvEntityRegistry(dataPath);<br />_storageRegistry = new StorageRegistry<br />{<br /> DefaultDrive = new LocalMarketDataDrive(dataPath)<br />};<br /><br />_connector.InitializeStorage(_entityRegistry, _storageRegistry);<br />_entityRegistry.Init();<br /><br />_connector.StorageAdapter.DaysLoad = DateTime.Now.Subtract(_connectorAccount.StartTrading.Value);<br /><br />_connector.StorageAdapter.Format = StorageFormats.Csv;<br />_connector.StorageAdapter.Load();<br /></div></div><br /><br />The problem is that when I connect to TWS, I get the following error message:<br /><br />Message 'Connect,T(L)=2017/11/06 21:25:31.278,Error=At least one connection should be made.' caused processing error.<br /><br />with inner exception message:<br /><br />The given key was not present in the dictionary.<br /><br />and inner exception stack trace:<br /><br /> at System.ThrowHelper.ThrowKeyNotFoundException()<br /> at System.Collections.Generic.Dictionary`2.get_Item(TKey key)<br /> at Ecng.Collections.SynchronizedDictionary`2.get_Item(TKey key)<br /> at StockSharp.Algo.Connector.ProcessConnectMessage(BaseConnectionMessage message)<br /> at StockSharp.Algo.Connector.OnProcessMessage(Message message)<br /><br />https://stocksharp.com/topic/8796/Storing positions2017-11-06T22:27:33Z2017-11-06T22:27:33ZJohan Kirstenhttps://stocksharp.com/users/99551/info@stocksharp.comHi<br /><br />I need to store my positions so that when my application starts up it can load the existing positions. The code I use is:<br /><br /><div class="code"><strong>Code</strong><div class="innercode"><br />var dataPath = @"Data\" + _connectorAccount.AccountName;<br />_entityRegistry = new CsvEntityRegistry(dataPath);<br />_storageRegistry = new StorageRegistry<br />{<br /> DefaultDrive = new LocalMarketDataDrive(dataPath)<br />};<br /><br />_connector.InitializeStorage(_entityRegistry, _storageRegistry);<br />_entityRegistry.Init();<br /><br />_connector.StorageAdapter.DaysLoad = DateTime.Now.Subtract(_connectorAccount.StartTrading.Value);<br /><br />_connector.StorageAdapter.Format = StorageFormats.Csv;<br />_connector.StorageAdapter.Load();<br /></div></div><br /><br />The problem is that when I connect to TWS, I get the following error message:<br /><br />Message 'Connect,T(L)=2017/11/06 21:25:31.278,Error=At least one connection should be made.' caused processing error.<br /><br />with inner exception message:<br /><br />The given key was not present in the dictionary.<br /><br />and inner exception stack trace:<br /><br /> at System.ThrowHelper.ThrowKeyNotFoundException()<br /> at System.Collections.Generic.Dictionary`2.get_Item(TKey key)<br /> at Ecng.Collections.SynchronizedDictionary`2.get_Item(TKey key)<br /> at StockSharp.Algo.Connector.ProcessConnectMessage(BaseConnectionMessage message)<br /> at StockSharp.Algo.Connector.OnProcessMessage(Message message)<br /><br />