Click here to Skip to main content
15,887,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I am building a depth of market ladder for futures trading using the CTS t4 api. the data may update more than every 100ms and I'm wondering if the standard dataGridView would allow updates this fast without bogging down the rest of the application.

What I have tried:

are there are any optimizations I could make or should I look towards a 3rd party extension?

thanks
Posted
Updated 9-Mar-24 14:20pm
v2
Comments
PIEBALDconsult 9-Mar-24 20:21pm    
dataGridView is not viable for anything but quick proof-of-concept and demos.
Find something better.
[no name] 9-Mar-24 22:44pm    
It "depends". Number of rows. Number of columns. How many "cells" actually need updating. "Virtualization" (the presence or lack thereof). And I suspect a "100ms" response time for a "market indicator" is not something that a "human" typically deals with. An automatic trading program ... maybe. The "data" may "update" every 100ms; that doesn't mean, the screen has too. Does a "1 second" refresh instead of 100ms make that much difference in this case? I doubt it.

The first problem is that Windows isn't an RTOS* so whatever you do you are going to run into problems if you truly need real time display updates. Which as Gerry has said, is actually quite unlikely because human response times aren't that fast!

The second is that the .NET framework isn't designed with real time working in mind: it operates on a garbage collection system, so response time to anything can't be guaranteed as at any moment your code can be frozen while teh GC does it's thing. Generally speaking, most processors are fast enough; most code doesn't mangle memory sufficiently to ever trigger the GC into action so you don't notice it - but sub 100ms updates to any control is going to burn though strings at a rate of knots unless it is specifically designed to cope. Which I doubt the DGV is, or any other control.

It's also going to depend on what an "update" entails: if it adds or removes rows then that's slow - very slow - if it changes individual values in a "static matrix" then that could be quicker.

In essence, while a DGV might work on your machine if you code for it pretty carefully, there is no guarantee that it'll last out a week with a "real world trader" but slowly bring the whole machine to a crawl instead. I think you are going to have to write your own code - and very carefully - to get anything like what you are asking for

* Real Time Operating System
 
Share this answer
 
Comments
ollie 2024 13-Mar-24 0:42am    
Yes, the api updates each individual value not whole columns or rows. I may have worded it wrong, by real time I meant a fast update from the time I receive the data from the api to the time the value in the DGV updates, in volatile scenarios it could be 20+ values at once. I have looked in the directories of a few popular trading platforms and most of them use 3rd party controls such as syncfusion dataGrid which may be the best way forward. thanks
Before you can answer the question, you need to understand what it is you are trying to solve here. When you talk about the refresh rate, it is worth thinking about what you actually mean here. If you were doing it a full refresh of data every time then you, most certainly, wouldn’t want to use the DGV. That’s not what happens typically with trading APIs though. The good ones provide partial refreshes, which only return data that has changed. If that’s the case, you should be looking at the volatility of trading, and whether you are likely to be subscribing to the full set of data, or a a smaller, more manageable set.

With that information, you are ready to perform tests. If I were you, I would look at binding data, and not trying to manage it yourself.

When I was doing this kind of application, I used WPF rather than WinForms. I got superior performance in WPF. Just something for you to consider,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900