python gui programming

If you are using python for financial, you should try the Anaconda distribution. Many people in scientific and financial areas that code in python use the Anaconda distribution. https://www.anaconda.com/. Furthermore, you should know the numpy, pandas, and matplotlib packages for python. They are used extensively in financial and scientific python programing. Matplotlib is a gui package for python. You should also get familiar with jupyter notebooks, an interactive python notebook. Great for prototyping and creating content to discuss with other people. This is one of the best things about python.
 
marcas, i'm in favor of sharing code and ideas. i find slack a little more inconvenient than this forum but i can
deal with it. i can't share my programs, for various reasons, but i have a few public web sites with some graphing
tools that anyone can use and i will share some code. most of what i do is java, javascript or vb. i have some
python code but not a lot, so far.

status1, there's another forum here called trading with microsoft excel. i haven't read many of the posts
but you might find help there.

I would suggest that we use a secure github repository, because then we can get proper version control. Getting complete source code packages in and out of Slack is worse than putting it in email.

Perhaps we should have Tom Nunamaker set up a code repository, so that it is not available to the general public.

Membership has its privileges !!
 
Github is the only way to go. It's pretty much the standard way to manage software and collaborate amongst developers. The free account only allows 500MB of private storage. If we do anything significant, this would be insufficient and we would have to upgrade and buy space. Or declare the project is viewable by everyone and you get unlimited space. Depends on how everyone feels about open source. There other considerations that may incur an expense, but not initially. For example, running CI/CD operations as a gateway to committing any changes to the master repo. A great way to guarantee quality. There are considerations that do not incur an expense often but require effort. For example, if you have many branches, it can be a real headache managing all the changes. Again none of this is necessary initially. Most just want to share source code, but if the code base is popular and the community contributes a lot, then these other considerations will come into play. Put another way, if you want to do this, it may require effort and expense.
 
since you guys hijacked my topic :) i want to return to my original problem: python gui programming.
the project i needed it for had to be sidelined because my data source went away but now my new
program needs a gui. i used tkinter and came up with the gui below. it's not pretty but it does the job.
if you knew how long it took me to get this far, you'd revoke my programming license. in all fairness, if i had
to do this in java w/o a gui editor it would be as painful. but i can't say i would recommend tkinter for anything
but the simplest gui.

Screenshot from 2020-08-08 17-11-05.png
 
Just a thought : Be aware that Luis Hamilton (F1 6 time winner),is not a mechanic nor a car engineer!

Cheers
 
Have you looked at Python GUI Programming Wiki? It lists all the GUI packages supported by category. Tkinter is python's standard package. It rides on top of tk and tk is required. Not the most efficient way of doing things, having one interpreted language riding on top of another. It sort of depends on what you are doing. If you are creating personal desktop apps where you don't care to much about the GUI appearance then tkinter is fine.
 
At work, we run python as a backend. All of the GUIs (front-end) are browser-based. There are some browser-based packages like PyJamas for python. This allows you to write all of your code in python. We actually write the front end in javascript, because this the native language of browsers. For performance on backend processing, we use C++ and create python extensions so we can access the C++ code from python. Doing this in 3 languages gives you extreme flexibility and performance. The downside is you are developing in 3 languages and builds can be tricky.

Several years ago a package called nodejs came out that allows you to run javascript natively on the computer (no browser). This allows you to write all your front-end and back-end code in javascript, avoiding developing in 2 languages. running a nodejs program is just as fast if not faster than python. Furthermore, I can package a project as a browser-based app or a desktop app or tablet app or phone app or a PWA. All of my personal projects are now written this way. I use a standard GUI styling guideline called Material IO. I use SQLite as a database on the backend. With respect to my own projects, over the years I started with Java, moved to Python, and now Javascript.

Just curious, what programming editor are you using? For python, I think PyCharm or VS Code are the most used. I use VS Code because of the multi-language support. Both have extensive support and make it easy to spot issues.
 
i use emacs for my python programming editor. i use jupyter to develop python and then convert to py.
my main programming effort is java and javascript. i won't do any future large desktop programs. i'm
moving mostly to the web. i use netbeans for java, javascript, and php and andriod studio for mobile.
if i were to get serious about large python programs i'd probably go with visual studio. i use visual studio for
visual basic but it's a very old version.
 
i had some kind of wakeup moment recently. i do C++ and python almost exclusively, some C++/Qt for user interfaces. on the python side i have felt handicapped whenever i needed a GUI, i am using dash and bokeh (great, but limited), and i had to dive into custom-extending those packages when i needed special things, an attempt which has fizzled. it struck me only recently that i might have been hammering nails with a screwdriver, insisting that my beloved python should do 100% of the job. i have also avoided javascript like the plague, while the world moved on to Typescript/React/Angular/Vue. so i grabbed Angular, stepped through its tutorial and was impressed that i could do so much in so little time (tutorials are like that), then did a little feasibility project with Angular and python/flask as the backend. much to learn, obviously, but i think i have been self-obstructing for the last 10 years by not opening up to web technology earlier.
 
I am using Angular as a javascript framework. I am also using angular material for material.io styling. Angular is a much more heavyweight framework. It has everything and as such has a steeper learning curve. I am done some stuff with React. I hear good things about Vue.

If were to form a group what projects would you be interested in tackling?
 
i didn't like my first version so i did a version 2. this one took much less time, mainly because i knew
what i was doing this time. i used the place() window manager that lets you specify coordinates for the
location so you can put controls anywhere you want. the previous version used a grid layout, which is
easier to place, but if you have different sized controls it doesn't look very good. with some planning
ahead of time, you can do something like this in way under an hour. it's still not a complicated gui and
it's not resizable, that would take considerably more work, but there's no reason to resize it. if anyone
wants to use this as a baseline, let me know and i'll make the code available.


server_window.png
 
i can get etrade quotes, but not in this application. i may add it later. i have the api in java and can access quotes
with a java version of a quote server. etrade provides a sample java and python implementation when you
get approved for access. etrade uses oauth1, which is pretty complicated. the python code has a library
that implements it so it wouldn't take a lot of effort to quotes.
 
If were to form a group what projects would you be interested in tackling?

This is a tough one.

It's tough for many reasons that don't need to be listed now. Few of us here have quite an experience in creating apps and undoubtedly are able to handle heavy lifting but I propose to start small and simple, if we are to start at all. Maybe let's look at some minuscule task that will have practical use. I propose to tackle code of TOST ( forums.aeromir.com/threads/tg1-reference-from-marcas.1481/ ). It is not because it's mine but because it is ready to start to be worked upon. Idea is decent, code is crappy. Each trader/coder can approach this individually and do whatever he wants with it and share results with others at the open. No formal cooperation needed. If necessary git-hub can be created, but only if project gets any traction. Non coders can look at it and provide ideas/requests. And also see what can be achieved.

TOST is just an example. It can be anything that have practical trading use. Anybody can pass ideas requests for other simple and useful applications, preferably broker and data independent. Starting this way we can see how it goes and, maybe, look for more complicated projects.
 
i'm continuing to tinker with the tkinter gui. this past weekend i discovered how easy
it is to get maplotlib graphs into a tkinter canvas. they don't look bad. i'm not saying
tkinter is a good gui platform but it's not as bad as it looks from initial impressions.

chains.png
 
Hi Jim, the Tkinter interface looks nice. Tkinter is nice and works well enough for simple dialogs and single-window applications. For more complex tools that handle lots of data and dynamic interactive graphing are better done in Jupyter Notebooks, or in desktop tools using PyQt Designer or PySide Designer. You can produce high-fidelity interfaces with the styling elements of JavaScript/CSS.

PyQt and PySide toolkits are nice because they provide every type of desktop windowing widget offered by the native windowing toolkit. They are also fully cross-platform (Windows, Mac OSX, Linux, mobile and embedded devices) with no platform-specific "tweaking" required. They require an intermediate understanding of Python object-oriented mechanics because their API wrappers map directly onto the native OS windowing toolkit C++ APIs.

Jupyter Notebooks are becoming the defacto platform for data science teams that need web front-ends for less technical users. I am preparing a set of tools and examples in Jupyter Notebooks for interactive widgets that analyze data pulled from TOS and stored in backend databases.

I have had limited time to learn the 2 or 3 decent ThinkOrSwim API wrappers available now. They are all good starting points but incomplete. We need to merge them together and provide better examples for how to use them for the different tasks of trading. I have been focused mostly on Python front-end tools, but my bottle neck has always been getting my TOS transaction data captured into a database automatically.

There are new Python-based interactive GUI frameworks coming out every month that wrapper React, Node.js, CSS, and other JavaScript front-end frameworks code and generate code for web-based GUIs. High-performance desktop GUIs require more powerful tools like Qt. Efficient web and desktop GUIs can generated, ala PyQt Designer and QML, and other GUI markup languages. I want to learn as few languages as possible, so I trying to do as much as possible in Python and Jupyter.

My point of view is that we should create classes of tools that brokers (TOS, IB, eTrde, others) have a vested interest in NOT providing.

1) A (near) real-time TOS-integrated local database for performance reporting on trades (PostgreSQL, MySQL, or SQL Server)
2) Open-source front end tools that analyze and display trade performance results.
3) Open-source utilities to help get data into and out of our trade analysis, trade selection, and trade monitoring tools.
4) Open-source data utilities to capture trading instrument data via APIs and web scraping tools and store them in databases.
4) Open-source algorithmic backtesting, simulation and trading tools (with good front-ends).
5) Open-source market and economic analysis tools.

I am not a high-frequency trader so I consider automated order placement and order management to be lowest in priority. I can overtrade and generate too many commissions on my own without having an automated system exacerbate the brokerage commission and fees taxes. I can use TOS and IB very well enough to place and monitor trades once I know what and when I want to trade. It is the tools "around" the brokerage trading platform that are missing. These missing tools partially account for the gap in performance between retail and professional traders.
 
I am preparing a set of tools and examples in Jupyter Notebooks for interactive widgets that analyze data pulled from TOS and stored in backend databases.

I have had limited time to learn the 2 or 3 decent ThinkOrSwim API wrappers available now. They are all good starting points but incomplete. We need to merge them together and provide better examples for how to use them for the different tasks of trading. I have been focused mostly on Python front-end tools, but my bottle neck has always been getting my TOS transaction data captured into a database automatically.

when you refer to thinkorswim api do you mean the td ameritrade api? when i contacted thinkorswim about an api they told me to contact td ameritrade, but that was a while ago.

My point of view is that we should create classes of tools that brokers (TOS, IB, eTrde, others) have a vested interest in NOT providing.

that's an ambitious goal.
 
Both of you guys are going about this in the wrong way. Yes, you really should be using a GUI designer, I use https://labdeck.com/python/python-gui-designer/,Its free drag and drop, and can generate my components into python code. Another thing that I think we will all find interesting is that the software I use (https://labdeck.com/) has mathematical functions(it's called a finance package) that can be used for trading, cryptocurrency, and things like what you guys are talking about. The problem is that I'm a great coder but I'm not really a good trader. I could make a useful GUI for trading but whether or not it makes a profit would be unknown. What do you guys think?
 
Top
Contact Us