python gui programming

Thanks for the link. I didn't know about this one.
This lib may be very handy for some purposes and I can see why Labdeck can look appealing to some. I also see some setbacks, even if only potential ones. I do not see enough to make me switch or even try Labdeck. That is not to say it is bad or anything.

I would like to hear why do you think that other ways are 'bad'. If GUI does the expected work and coder is comfortable with it...
Would like to see some working projects, trading related, done with Labdeck, from what I've seen I don't see much potential. (It still can be great platform for other purposes).
 
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?
Hi AaronP, I just saw your posting. Thanks for the heads up on labdeck. I will take a deeper look into labdeck to see how it hooks into the final application and frameworks needed for data, orders, etc. It talks about "MatDeck documents" but it is not clear from their website if the production code requires MatDeck framework as the runtime. I need to read more about it and try out the toolkits.

What GUI toolkits besides Tkinter does MatDeck support? Tkinter is often a non-starter except for the simple utilities and lobal pop-up dialog boxes and single-window interfaces; it seems not scalable for enterprise-quality applications. I have used PyQt Designer quite a bit for GUI layouts, and then modified the PyQt code using Spyder, PyCharm, or VSCode. The Qt application frameworks are nice because they support much more than just GUI design and code generation. PyQt Designer is a bit kludgy, because it does not offer real-time round-tripping ("design-to-code-to-design-to-production") between code and GUI layouts. If I were a good C++ programmer I would just use Qt Designer C++ because it does real-time interactive design and code generation. However, right now there is still a compilation step to generate the Python wrappers to convert the C++ APIs. Recently (Jan-Mar 2021) I see signs that people are working on improving the round-trip process for a GUI-first for native Python programmers.

After the GUI design is done with QtDesigner, there is still a lot of work to be done to hook the generated GUIs into the other pieces of the application infrastructure (databases and file stores, data feeds, order management, etc.) and algorithms.

Qt is a bit of a moving target (or fast moving train, now Qt v6 just released), with breaking "enhancements" and always with a shortage of full examples with documentation that work. Send me your contact information ( [email protected] ) and we can get in touch regarding coding trading apps in Python. Thank you.
 
This discussion is very interesting. I am just beginning to learn Python.
The way I learn is to start a specific project to do one thing. I export trades from TOS into a csv file. Then I have to manually scroll thru the csv file to find the option trades . Then I have to manipulate this data so I can determine the profit and loss on each spread.
I would like to learn how to do this with Python.
Q1.) What resources would you suggest I use to learn Python and how to parse a csv file?
Q2. ) I learn lots from code snips: Where might i find some Python code snips which can read a csv file?
Q3.) What Sourceforge links are useful to read csv files?
Q4.) This thread has some discussion about using the TOS API. I know nothing about the TOS API. What resources would help me understand how to use this ? Perhaps this is useless for what I want to do?
 
Hi Cellsee6,
I understand that you starting with Python and with coding altogether. There is an intellectual journey ahead and you can stay on it as long as you wish. It can be even lifetime exercise that is destine to remain uncomplicated :D

You'll be looking around and trying different things. My advice is to spend some time thinking about what you close goal is and focus on that. Don't fill guilty if something attracts you (distracts you) from time to time.
For what I understand your position re python, you've chosen right path. Code something useful even if it is a few lines long only. Getting value of spreads might seem small task but you need to think how to handle options data in your code which will have a big impact on your future projects - if related to options.

Q1 / Q2 - There are so many of resources that you wont be able to sift through all of them, especially that you still don't know what to look for. Also your requirements will change over time. I single out RealPython although their articles are often unbearably long. You start with free tier and stay with it to see it it fits you.

About reading / parsing csv - just google it. There are tons of material on the subject. Choose the one you like/understand. Ask yourself if you want to be an expert in various ways of reading/parsing csv or just read csv and work with the data.

Q3 - I'm not familiar with Sourceforge but again - just google 'python read csv' (Try not to use google if you can :) )

Q4 - Don't worry about TD-API yet, it will only confuse you. You can get the same data by manually exporting them to csv. If you can handle data effectively and effortlessly then you can focus on obtaining them in some alternative way (TOS, yahoo and others). This is my personal pow. I deal with py for few years and, while using TD-API, still manually import some data from TOS to track my positions' p&l and to display them the way that suits me (TOS is not bad but lacks some capabilities I like to have). Just keep coding and enjoy it.

It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to.

Good luck.
 
Cellsee6, IMHO while you play around with Python ,or any other prog language, never loose track of the objective of your effort!
Do you want to learn trading or be a provider of services to other in the financial sector (.....programmer)?
Learning ,and spending time on Python or else..will not make you a better trader.
To make it short, to send an email ,you don't need to build a program ...you can just use what is out there.and focus on the message.
Spend money if need too BUT ALWAYS SAVE TIME!

Tom
 
Both Marcas and Tb2018 offer some great advice. Python will be a rich and deep world, but very accessible. There is so much online, and for free, that you should be able to put pieces of code together quickly to accomplish what you are looking for. Or if you prefer, there are some well-structured paid courses that could be useful as well. Some of these can get into programming concepts and theory such as Object Oriented Design. It depends how far you'd like to go with Python and your previous computing and programming background.

To help narrow that path for your specific question about reading a .csv file, I'd suggest that you start with a quick look at the pandas package. It's very common and frequently used, especially for datasets that you'll likely be working with for stocks and options. The concept of a dataframe will become central to anything that you are building. Simply put, it's the view or load of structured data that you'll be working with, e.g. a part or all of that csv data organized into rows and columns, much like a spreadsheet.

Once you've imported pandas into your Python script, reading or pulling data from a csv file is as simple a command as "pandas.read_csv(query_string)" where query_string is your path and name of the csv file. From here you can add commands to display or print that data in the dataframe, graph it in numerous ways, work with or modify columns or parts of the data, and save it off to some different format, to name a few of many, many choices.
 
And to add, Sourceforge (https://sourceforge.net/) is a website where people share code snippets or full packages. Many of the web searches and articles that you'll read will point you to some user's folder, or the author's folder, on Sourceforge. You can cut/copy code or download packages directly from there for use in your programs. It's a centralized storage and sharing location for getting the latest updates published by individuals.
 
Tb2018, not sure how universal your advice is but in my case you hit the nail in the head.

When starting adventure with coding my plan was to learn coding to use it in trading. When realized how much material is out there to cover, I promptly adjusted my goals to learn only those parts that relates to trading. Thus, I consciously left out many areas of coding uncovered. For example I cant write an e-mail program out of my head - relatively simple task (but I know where and what to look for if such need arises).

The same idea was behind me writing about considering goals beforehand. In my case it was ‘trading first’ but not all cases are the same.

You are right again that saving time is a major factor. Aka there isn’t much sense (imo) to spend time to make exact copy of TOS or tradingview. It can be done but for what? Well, joy of coding can be one thing but we leave this aside.

“Python or else..will not make you a better trader.” Right again. Actually coding can make your trading worse but also can make it much better and can speed up developing your trading skills.
A while ago I’ve heard some veteran trader taking about bringing data from floor sessions home and staring at them until they ‘started taking’ to him. The same motive you can find in other sources. “Reminiscences of stock operator” is one of them (one of my favorite books on trading :) .

All depends how you use your skills. If you are familiar with Tom’s spreadsheets (TG1) they do provide new value, organizes data in a way that suits him and make him understand better and faster what market does and speed up making trading decisions -> less stress → less errors → more jouful trading etc. It’s worth something. Can you find ready software for that? Sometimes you can ($$ & time) sometimes you can not.

Well… instead of typing and typing on the subject I’ll post a simple example how coding can speed up learning process (glancing at sheets of numbers for weeks/months, or using existing software which is not tailored to answer your questions). It likely be trivial for many but as an example it should do. I post it in a separate topic bc I hope there will be some reactions and we (I mean I) can learn something useful together.

DaveN, you are on the same page. Actually it was on OOP when I realized that I want to learn coding for trading not just coding. I stopped OOP discovery process and returned to it only it was really needed.
Pandas is, of course good advice but I wouldn’t recommend starting with it. Some coding basics need to be learned first (list manipulations, iterations, data types, navigating editor etc).

Cellsee6, there was little practical help in my previous response.
To parse csv from TOS you have to examine structure of an AccountStratement.csv ( whatever the actual name is) and find any patterns you can exploit.
When you know what the pattern is, you read the file, line by line, and find mark points (like a name of an interesting subsection or empty line) and assign relevant part of csv to a variable, or a list, or dict, or anything you decide to use.
This is basically the same process you do manually in Excel (but faster and not error prone (if done right).
 
Top
Contact Us