Plot millions of points in Python 30x quicker

Plot millions of points in Python 30x quicker

I like numbers. However, if you give me a choice between staring at a table full of numbers and a chart, I'll probably choose a chart. Very often when looking at markets it's easier to look at a chart, rather than staring at pages of numbers. The great thing with interactive charts is that we can get more easily explore a dataset, zooming in to delve into a time series more thoroughly, if we have enough data. In Python there are lots of great charting libraries. I've written my own library chartpy, which creates a common interface for plotting in plotly, matplotlib and bokeh. Simply, change a single keyword to switch between the libraries (rather than having to learn the different APIs of each library).

Let's take for example a plot made up of minute data for EUR/USD, sometimes we might simply want the bigger picture, at other times we might want to zoom in to look at specific episodes on an intraday basis. If we're looking at several years of data though, this means plotting lots of data: over 10 years this would result in over 3 million points. If you try to plot millions of points in matplotlib, it'll take a long time to display. Furthermore, try zooming in on these complex plots and it'll also take time to update. So what's the solution if you want to display millions of points quickly in Python?

Computers are obviously capable of displaying very complex graphics, just think of all the cutting edge computer games, which use the powerful GPUs on graphics cards sitting in our computers. Can we use tap into similar technology to plot complicated market data? Yes, we can! One library which makes it possible is VisPy, which leverages the powerful GPUs on modern graphics cards for creating graphics. I have written a wrapper for VisPy, in my chartpy library, so users just need to change a single keyword to switch from matplotlib to VisPy. I've also written a code example, at...

To read the full article click here to go to the Cuemacro website


要查看或添加评论,请登录

Saeed Amen的更多文章

  • Learning from running financial models live

    Learning from running financial models live

    Let's say you are the world's best burger chef (we all have ambitions, right). You'd be serving up all manner of…

    1 条评论
  • DeepSeek, objectives and constraints

    DeepSeek, objectives and constraints

    When a new burger joint opens up, there's often a buzz. Everyone (well, at least me) wants to try the new burger.

    1 条评论
  • Hundreds of quant papers from #QuantLinkADay in 2024

    Hundreds of quant papers from #QuantLinkADay in 2024

    I tweet a lot (from @saeedamenfx and at BlueSky at @saeedamenfx.bsky.

  • What we’ve learnt from reading thousands of Fed communications

    What we’ve learnt from reading thousands of Fed communications

    We recently had the last FOMC decision of 2024. Market l participants reacted to the hawkish tone including Powell’s…

    1 条评论
  • Takeaways from QuantMinds 2024 in London

    Takeaways from QuantMinds 2024 in London

    Over the past years, the quant industry has changed substantially. My first visit to Global Derivatives was just over a…

    12 条评论
  • Takeaways from Web Summit 2024

    Takeaways from Web Summit 2024

    Think of Lisbon and no doubt it’ll conjure images of explorers setting sail in centuries past across the ocean, the…

    1 条评论
  • FILS Europe 2024 Takeaways

    FILS Europe 2024 Takeaways

    Paris is home to many things, the Eiffel Tower, the Arc de Triomphe, burgers (ok, I made that one up!). In recent…

    4 条评论
  • Don't look back in hangar steak

    Don't look back in hangar steak

    I'm currently in the queue for Oasis tickets. Rather than mindlessly watching the counter of people in the queue ahead…

    5 条评论
  • The Olympic spirit for forecasting

    The Olympic spirit for forecasting

    The Olympics finally finished, and the Paralympics are about to begin. I managed to go to some of the Olympic football…

  • Eleven years of independence

    Eleven years of independence

    Regrets become ever more edged with the passing of time. Recalling a time long gone, when perhaps a decision made, was…

    5 条评论

社区洞察

其他会员也浏览了