Menu

#97 Financial data, add option to remove gaps for discontiguous data

open
nobody
None
5
2020-03-16
2020-03-14
Josh Thames
No

TLDR:
Provide method to:

  • display financial (perhaps any) timeseries data to screen without the appearance of gaps in the chart
  • Must not screw with the primary key/date for each bar (no other data mangling techniques allowed).
  • Bonus Points: provide method to set the gap in pixels between bars (setMinSymbolWidth / setMaxSymbolWidth is great, but could be just a little bit better since the point is control the gap between the bars, not their size).

FULL:
This problem keeps me up late at night. I have nothing but prasie for this library thus far, including the QwtPlotTradingCurve and friends. My issue is with how handling the gaps in financial time series data correctly. Most general purpose charting libraries that include financial data display are simply falling short here. Feelings of dissapointment have moved on to agony. The examples/stockchart is a perfect example. There are hideous gaps in the chart for when the market is closed! I've looked at thousands of stock charts and I've never, never, never ever seen gaps in the charts.

Example charts online:
https://finance.yahoo.com/quote/AAPL/chart?p=AAPL
https://www.tradingview.com/chart/jgTyFZEk/

I've been using QCustomPlot, which is eerily similar to Qwt, and essentially I'd have to fix it myself by lying to the axis about the date so that when the chart is plotted the gaps are removed. That just shifts the problem down to other areas like displaying the real date/time to the user during zoom/scroll etc. I haven't come up with a solution that is bug free, so I'm turning to you all here.

I've unneccessarily annoted a screencap to point out an offending gap area.

This is actually a very hard problem (IMO) because it requires the programmer to get down in the weeds of how the charting software is working. I'm not affraid to get down in there, but sometimes the weeds win and I don't come back up.

I also updated the min/max size of bars to remove some of the extra space between bars on regular time intervals. Tested on 27" 4K monitor and 24" 1080p monitors.

        curve->setSymbolExtent( 12 * 3600 * 1000.0 * 1.30);
        curve->setMinSymbolWidth( 3.99 );
        curve->setMaxSymbolWidth( 60.0 );
1 Attachments

Discussion

  • Uwe Rathmann

    Uwe Rathmann - 2020-03-15

    This looks like a request for a specific transformation ( QwtTransform ) and some improvements for QwtDateScale engine to drop gaps from its calculation.

    If you like you can contact me on one of the official support channels ( forum, mailinglist ) and we do things together.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB