开发者

Building a trading platform with charts - suggestions for a Python GUI Library

开发者 https://www.devze.com 2023-01-26 05:21 出处:网络
I am building a small program to retrieve data from the market and chart it in real time. While the trading decisions will be largely automated, the charts are updated continuously so that someone can

I am building a small program to retrieve data from the market and chart it in real time. While the trading decisions will be largely automated, the charts are updated continuously so that someone can keep track of how the decisions are being taken and manually intervene when necessary.

What would be a good GUI Library for the task (for Python). Here are the considerations -

Programming Language : Python (Do you think I s开发者_运维技巧hould use something else? May be even do the GUI and backend in different languages?!!).

Operating System : Preferably cross-platform, but if it has to be platform specific, then Linux it is.

Speed + Learning Curve : While time (low latency) is not a critical issue and I would prefer something easy to use and fast to learn, the program has to feel responsive and I would not like to trade speed for ease of coding beyond a certain point. I guess this is the part where your experience could help me out.

I had strongly considered WxPython, but some of the comments said it was not well-designed (as in, doesn't fit well with Python!)

So the complexity of the task and meta-considerations have been laid down in front of you. Please help/suggest.

P.S. : While we are at it, if someone could comment on a suitable charting library as well, it would be nice.


For plotting in Python, I'm a big fan of Matplotlib (http://matplotlib.sourceforge.net/) which is essentially a more user-friendly wrapper built on top of Pylab (http://www.scipy.org/PyLab). It's really powerful and has a TONS of documentation and examples. It doesn't sound like your charts are very complicated, so you probably won't have to dig too deeply into the package; I think the development gets hairier the deeper into the API you get, but that's probably true of most packages.

I happened to end up using the Tkinter backend, but matplotlib also supports QT, WxPython and others. I'm not a huge fan of Tkinter or WxPython and probably would've used QT instead given the choice, but it's nice that all the options are there. I've used matplotlib on both Linux and Mac OS X with a lot of success.

As a side note, here's an interesting related SO post on plotting in WxPython if you decide to go that route: What is the best real time plotting widget for wxPython?


Go straight with wxPython if you feel it comfortable. There are a lot of toolkits out of there and they all have pros and cons and you will always find people complaining about them... wxPython is a good choice, you are going to find a lot of documentation around the internet and it is highly interoperable with matplotlib, as sgusc said, and also with OpenGL if you want something more sophisticated for your plots. If you need to perform intensive calculations, before moving to another language, i suggest you to consider cython (http://cython.org/) that can speed up your code but unless you see that speed becomes a problem stick to a single language. Pay attention not to mix the logic with your gui and I think it would be fine. If you want some good references look at:

  1. http://www.blog.pythonlibrary.org/
  2. http://zetcode.com/wxpython/

Enjoy :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消