¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Performance optimization when exporting data to excel


 

Well, weight in the fact that I am not a fan of Excel for handling fast pace data. (and here you deal with 'ticks' which is rated 2nd fastest data set of the API) Maybe other members have better experience.
Typically what seems an easy start may end up pretty painful, spending precious hours tweaking and 'workarounding' Excel limitations that will eventually fail to your expectations.

IMHO and without understanding if your purpose is to get an Excel spreasheet to look at, or to use Excel to compute and takje decision. Anyway you better organize "rendez-vous" in your code and get ride of "loop".
In short: you need a multi-thread method. yours seems single threaded. C# have good provision for it.

Assuming you never stop the 4th loop. Look to me that you need a 5th 'loop' (a thread in real), this is probably the most important for you within your current architecture, and it must be in a separate thread, this one only handle saving data.
Using SQL could be a simple solution as this will allow you to save faster (maybe) and more important collecting data from a central repository that by itself have all provision to handle concurrency of data access. This would preserve most of your existing code.

However depending upon how serious is your project you should use more of an appropriate language like Java or C# (in full) or C++ , it's not so hard to get some fundamental and it pay.
The API allows you to start any request you mention asynchronously and ASAP, Scanner answers are pretty slow, can be done at this moment. Be careful with contractdetails you may hit many pacing limitations.
IB have a pretty efficient and fast API, you can't keep up using Excel as the orchestrator.

Seems you use C#, keep the effort, if you don't know how to do multi-threading, start learning how to launch a thread, then either connect to a MySQL or learn how to share data between thread using a mutex, then ... many many details but later.

Join [email protected] to automatically receive all group messages.