Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 should 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.

like image 970
Soumendra Avatar asked Nov 23 '10 05:11

Soumendra


People also ask

Is Python good for GUI development?

While being incredibly useful for the fields of data science and machine learning, Python is also great for developing graphical user interfaces! In fact, it has many frameworks that even beginners can use to easily get started with developing a GUI.

How do you create a GUI in Python?

If you're new to creating GUI's in Python the basic steps are to: Import the Tkinter module: import Tkinter, top = Tkinter.Tk() Create the GUI main window that will “house” your GUI and widgets. Add whatever widgets your GUI needs including buttons, labels, lists etc.

What do traders use Python for?

Python makes it easier to write and evaluate algo trading structures because of its functional programming approach. Python code can be easily extended to dynamic algorithms for trading. Python can be used to develop some great trading platforms whereas using C or C++ is a hassle and time-consuming job.


2 Answers

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?

like image 190
Brent Writes Code Avatar answered Sep 22 '22 13:09

Brent Writes Code


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 :-)

like image 34
ingframin Avatar answered Sep 22 '22 13:09

ingframin