I have a Strategy that needs data from a database that requires a slow database query. It does the query then puts the results from the query into a simple C# generic Dictionary.
I am trying to make my optimizations of 1000's of contracts at once much faster by only calling this slow database query 1 time for the entire optimization, or at least only 1 time per thread, not 1 time per contract, as I have been doing in the Strategy's "Initialize()" event.
I have geen trying to do this by doing the database statement in the static constructor of my strategy, but when I do this only about 20% of the trades occur, as though 1 thread is getting the data and the other threads are not.
What is the best way in code to do a slow database query one time per optimization (or one time per thread), instead of one time per contract?
Thank you very much in advance!
ChiTrader2000

Comment