Storing positions~/topic/8797/storing-positions/Copyright @ StockSharp Platform LLC 2010 - 20242024-03-28T23:22:34Zhttps://stocksharp.com/images/logo.pnghttps://stocksharp.com/posts/m/41574/Yes, InitializeStorage will reset entire adapter settings. Including all inner adapters.2017-11-09T08:31:07Z2017-11-09T08:31:07ZSupporthttps://stocksharp.com/users/97869/info@stocksharp.comYes, InitializeStorage will reset entire adapter settings. Including all inner adapters.Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/41561/Hi I think I found the problem. When I changed the code as follows, it worked: var adapter = _connec...2017-11-08T23:44:15Z2017-11-08T23:44:15ZJohan Kirstenhttps://stocksharp.com/users/99799/info@stocksharp.comHi<br /><br />I think I found the problem. When I changed the code as follows, it worked:<br /><br /><div class="code"><strong>Code</strong><div class="innercode"><br /> var adapter = _connector.Adapter.InnerAdapters.OfType<InteractiveBrokersMessageAdapter>().First();<br /><br /> _connector.InitializeStorage(_entityRegistry, _storageRegistry);<br /><br /> _connector.Adapter.InnerAdapters.Add(adapter);<br /></div></div>Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/41543/Could you please send us small example for reproduce? support@stocksharp.com2017-11-08T12:39:58Z2017-11-08T12:39:58ZSupporthttps://stocksharp.com/users/97869/info@stocksharp.comCould you please send us small example for reproduce? <a href="mailto:support@stocksharp.com">support@stocksharp.com</a>Copyright @ StockSharp Platform LLC 2010 - 2024https://stocksharp.com/posts/m/41516/Hi I need to store my positions so that when my application starts up it can load the existing posit...2017-11-06T22:30:01Z2017-11-06T22:30:01ZJohan 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 />Copyright @ StockSharp Platform LLC 2010 - 2024