Profile Picture

Updating Symbol.CurrencyType causes exception

Posted By ErkSubasi 8 Years Ago
Message
Posted Wednesday December 09 2009
Hi,

I am working with a relatively big (~600) watchlist where the components are equities from mixed european countries. While initially creating my watchlist, I have provided only the names of the stocks and let the currencies to be equal to a dummy value 'USD'.

But during my simulation I would like to convert each symbol to its real currency before execution and in order to do that I am calling " Symbol.CurrencyType = CurrencyType.X; " (X is read from a database accordingly) in my MySystem.Startup() method. My expectation is once I provided the currency type and the required forex series, RE will take care of the necessary conversion; but apparently I am getting the below exception. What do I miss?


An exception of type System.Collections.Generic.KeyNotFoundException was thrown.
The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at RightEdge.Common.x3da600d6153dd471.get_Item(Symbol key)
at RightEdge.Common.SystemData.xad2b458a905382a5(Symbol xc1db5dbaf009ebd2)
at RightEdge.Common.UserSeries.get_xeeedc627c3d07705()
at RightEdge.Common.UserSeries.get_Count()
at RightEdge.Common.IndicatorManager.UpdateCharts()
at RightEdge.Shared.SystemWrapper.InitializeModule(SystemData systemData, SystemRunInfo dndInfo, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(SystemData systemData, SystemRunInfo runInfo, Dictionary`2 historicalData, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.SystemWrapper.RunSystem(DateTime start, String filename, ServiceFactory brokerFactory)
at RightEdge.Shared.TradingModuleWrapper.RunSystem(SystemDataCreationSettings settings, Dictionary`2 historicalData, SystemRunInfo dndInfo, ServiceAppDomainFactory brokerFactoryFactory)
at RightEdge.SystemProgress.InitAndRunSystem()



Thanks,
Erk
Posted Wednesday December 09 2009
CurrencyType is part of the key in the Symbol object. Changing this will change the hash table and result in the error that you're seeing. Why are you changing the CurrencyType at runtime? Can you do it in the watchlist instead?
Posted Wednesday December 09 2009
Thanks for the quick reply Bill. I see what the problem is.

Then,initially I want to manipulate my instruments data by a script which reads the corresponding currency type for each instrument from a database and updates it in the folder. The problem is; I can not read and update the binary file type of instruments in the "Data Store" folder. What would you suggest.

Posted Thursday December 10 2009
The currency type is stored in the watchlist file. Are you looking to change it permanently? If so, modifying the xml file that the symbol configuration is stored in is possible. The symbol data is stored in a file called SymbolConfig.xml. It's human readable and see this post for some source code to read it in from code.

ErkSubasi (12/9/2009)
Thanks for the quick reply Bill. I see what the problem is.

Then,initially I want to manipulate my instruments data by a script which reads the corresponding currency type for each instrument from a database and updates it in the folder. The problem is; I can not read and update the binary file type of instruments in the "Data Store" folder. What would you suggest.

Posted Friday December 11 2009
You should be able to update your watchlist by editing SymbolConfig.xml as Bill suggests. The Binary Data store stores the data for each symbol in a separate file, so you can just rename the files in that directory to transfer the data from one symbol to another. The filename comes from calling Symbol.ToUniqueId().

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems