How Do You Build Systems Using Python?

Maybe, but as I doubt you trade in VB6 maybe you dont realise the languages are actually slower and less friendly to dev in, why there are so many VB6 users out there still.

Works nicer with Excel / Word ofcoure.

I didn't mean to compare VB6 with Python. My point was that you don't seem to realize that there are GUI frameworks and advanced IDE's available for Python.

But since you mentioned it, BASICA / QBASIC was my first language. My trading algo is currently coded in Excel VBA.
 
  • Like
Reactions: d08
Sorry for the vague title, couldnt think of a brief way to explain exactly what i mean.

I have backtested systems before on programs like Tradestation and CQG where you have everything in one place. Indicators, charts, an area to write the code etc. The code is pretty much picking an indicator and saying "buy above MA" and the software knows what "buy" "above" and "MA" all mean.

But with a coding language such as Python you have an empty white page to start writing and nothing else and doesnt seem to have much vocabulary unless you build it all from scratch. I dont understand where you get data, where you get the charts etc?

Say for example i knew how to code Python to a high level and wanted to test trading systems with accurate high level data (so im talking whats going on in the order book, volume available on the bid and ask etc) where would you get that from? Can it just be bought as a file? Is there an online server you tap into?

Just in laymans terms if you have the language how do you then build a system with it? Are there programs that look like CQG with all the indicators and charts etc?

Hope that make sense, its just at the moment i am learning python and getting pretty bored of getting it to print "hello world" and making text go upper and lower case. Dont see how i could apply anything to trading.

ck this guy out. You will learn a lot about python and program trading.
https://pythonprogramming.net/
https://www.youtube.com/user/sentdex/playlists
 
For what I Dev for clients not great at all, I didn't mess too much just wrote 1 app for a client, no GUI, using nothing more than a text editor, it's like how I was coding 30years ago.

More on about limited Syntax, having to load a library hassle for a basic VB function.

I hate VB.NET even more if that helps!

Java Scrip wasn't too bad, learned that for Google Sheets recently in about 2hours.

That's how I always code, using a slightly customized syntax aware text editor, that doesn't mean the language is basic.Loading modules in Python is a breeze though, yes, some very basic things need a module but that makes sense from a performance perspective.

While I haven't used VB myself, from what I know VB is just too old and a lot of the nasty outdated things have just stayed with it. People are mention stability problems.
Obviously the code is so much cleaner with Python and easy to read, VB looks very messy.
 
Sorry for the vague title, couldnt think of a brief way to explain exactly what i mean.

I have backtested systems before on programs like Tradestation and CQG where you have everything in one place. Indicators, charts, an area to write the code etc. The code is pretty much picking an indicator and saying "buy above MA" and the software knows what "buy" "above" and "MA" all mean.

But with a coding language such as Python you have an empty white page to start writing and nothing else and doesnt seem to have much vocabulary unless you build it all from scratch. I dont understand where you get data, where you get the charts etc?

Say for example i knew how to code Python to a high level and wanted to test trading systems with accurate high level data (so im talking whats going on in the order book, volume available on the bid and ask etc) where would you get that from? Can it just be bought as a file? Is there an online server you tap into?

Just in laymans terms if you have the language how do you then build a system with it? Are there programs that look like CQG with all the indicators and charts etc?

Hope that make sense, its just at the moment i am learning python and getting pretty bored of getting it to print "hello world" and making text go upper and lower case. Dont see how i could apply anything to trading.

not a big fan of python, but did you see this..

https://www.elitetrader.com/et/threads/qtpy-lib-a-new-algorithmic-trading-python-library.302115/
 
Had a look at python code. Not much difference or difficulty compared to other programming languages. Instead of finding which language is best, you should have a system which is profitable. Of Course coding does help to test your systems faster. Goodluck.
 
Sorry for the vague title, couldnt think of a brief way to explain exactly what i mean.

I have backtested systems before on programs like Tradestation and CQG where you have everything in one place. Indicators, charts, an area to write the code etc. The code is pretty much picking an indicator and saying "buy above MA" and the software knows what "buy" "above" and "MA" all mean.

But with a coding language such as Python you have an empty white page to start writing and nothing else and doesnt seem to have much vocabulary unless you build it all from scratch. I dont understand where you get data, where you get the charts etc?

Say for example i knew how to code Python to a high level and wanted to test trading systems with accurate high level data (so im talking whats going on in the order book, volume available on the bid and ask etc) where would you get that from? Can it just be bought as a file? Is there an online server you tap into?

Just in laymans terms if you have the language how do you then build a system with it? Are there programs that look like CQG with all the indicators and charts etc?

Hope that make sense, its just at the moment i am learning python and getting pretty bored of getting it to print "hello world" and making text go upper and lower case. Dont see how i could apply anything to trading.

You might find my blog interesting
http://qoppac.blogspot.co.uk/p/systematic-trading-start-here.html

Or this one
https://www.quantstart.com/

There are more links here
http://quantocracy.com/

GAT
 
Thanks for the answers. A few comments on whats been said so far.

1/ The reason for choosing Python is from asking a lot of people in the industry it seems to be the fastest growing language in banking/finance. My main priority is to enhance my own prop trading career, but would be good to "future proof my resume and Python will open the doors i want to walk through.

2/ Thanks for the links i will read through the blogs etc

3/ Quantopia looks quite good, seems to only focus on stocks though

4/ When you talk about libraries and GUI's is this like a palette of indicators etc? If i wrote "Bid Price" into Python would it know what i mean. Thats my main question i still dont seem to have answered (to my understanding) how to i write into Notepad etc a trading term will Python know the vocab i am using, i assume not. How do you get a trading vocab into Python?
 
4/ When you talk about libraries and GUI's is this like a palette of indicators etc? If i wrote "Bid Price" into Python would it know what i mean. Thats my main question i still dont seem to have answered (to my understanding) how to i write into Notepad etc a trading term will Python know the vocab i am using, i assume not. How do you get a trading vocab into Python?

Suppose Quantopian, Metatrader, Amibroker, Ninjatrader, etc. are like the calculator app on your computer. You type "5" "+" "5" "=" and you see "10" displayed.

Python won't do that until you give it instructions on _how_ to do that. Someone programmed the calculator app to simplify doing mathematics. Someone programmed the platforms listed above to simplify building algos etc.

Here's some crude pseudo code ("mainly" based on old school BASIC) to do what the calculator app did above:
Code:
CLS
PRINT "Please enter the first number.";
INPUT numberInitial
LET currentTotal=numberInitial
DO
    PRINT "Please enter an operator: +, -, *, or /.";
    INPUT operator$
    PRINT "Please enter the next number.";
    INPUT number
    IF operator$="+" THEN currentTotal=currentTotal+number
    IF operator$="-" THEN currentTotal=currentTotal-number
    IF operator$="*" THEN currentTotal=currentTotal*number
    IF operator$="/" THEN currentTotal=currentTotal/number
LOOP WHILE operator <>"="
PRINT "The answer is ";currentTotal
END

You are given smaller building blocks with programming languages, so it takes 'a lot' to program something useful, but you have 'total' control over every aspect. The other platforms give you bigger building blocks, so you can do things faster/easier, at the expense of control.

Libraries are essentially pre-built blocks of code that you can put into your program. These blocks do common, useful, and/or frequently used tasks, making programming faster/easier.

Crude, simplified, trading program block 'diagram':

Load historical EOD data (csv)
Check if data is up to date
No? Stop and display UPDATE DATA
Calculate [location of] first free column
Fill that column with SMA5
Fill next column with RSI9
...etc...

Each line above could represent several lines of code.
 
Suppose Quantopian, Metatrader, Amibroker, Ninjatrader, etc. are like the calculator app on your computer. You type "5" "+" "5" "=" and you see "10" displayed.

Python won't do that until you give it instructions on _how_ to do that. Someone programmed the calculator app to simplify doing mathematics. Someone programmed the platforms listed above to simplify building algos etc.

Here's some crude pseudo code ("mainly" based on old school BASIC) to do what the calculator app did above:
Code:
CLS
PRINT "Please enter the first number.";
INPUT numberInitial
LET currentTotal=numberInitial
DO
    PRINT "Please enter an operator: +, -, *, or /.";
    INPUT operator$
    PRINT "Please enter the next number.";
    INPUT number
    IF operator$="+" THEN currentTotal=currentTotal+number
    IF operator$="-" THEN currentTotal=currentTotal-number
    IF operator$="*" THEN currentTotal=currentTotal*number
    IF operator$="/" THEN currentTotal=currentTotal/number
LOOP WHILE operator <>"="
PRINT "The answer is ";currentTotal
END

You are given smaller building blocks with programming languages, so it takes 'a lot' to program something useful, but you have 'total' control over every aspect. The other platforms give you bigger building blocks, so you can do things faster/easier, at the expense of control.

Libraries are essentially pre-built blocks of code that you can put into your program. These blocks do common, useful, and/or frequently used tasks, making programming faster/easier.

Crude, simplified, trading program block 'diagram':

Load historical EOD data (csv)
Check if data is up to date
No? Stop and display UPDATE DATA
Calculate [location of] first free column
Fill that column with SMA5
Fill next column with RSI9
...etc...

Each line above could represent several lines of code.

Thanks Userque, thats what i was asking.
Obviously it would take forever to code even a basic program if you have to explain every single element/word you want to use in a code. It takes long enough to design a robust strategy let alone having to explain in code what a bid price is, or a moving average.

I assume Python trading libraries exist where you would just copy and paste the vocab into your code to save time.

Surely there is some piece of software out there where all the trading vocabularly is already pre installed?
 
Thanks Userque, thats what i was asking.
Obviously it would take forever to code even a basic program if you have to explain every single element/word you want to use in a code. It takes long enough to design a robust strategy let alone having to explain in code what a bid price is, or a moving average.

I assume Python trading libraries exist where you would just copy and paste the vocab into your code to save time.

Surely there is some piece of software out there where all the trading vocabularly is already pre installed?

Yes computers are like very dumb desk assistants, you have to explain to them exactly what do do. But once you've done it, they will do it repeatedly, and much faster than you can.

There are python libraries for things like moving averages (pandas is the most famous one). You don't have to explain what a bid price is, that's just a number. So for example:

moving_average=pandas.ewma(price, span=20)

Yes there are several 'trading libraries'.

quantopian is probably the best for someone who is relatively inexperienced but yes it's only for stocks right now. The other links I've sent you would require a better understanding of python than you have for now, but they are more flexible. Essentially the choice is:

- more work done for you (more 'vocab') but less flexibility
- less work done for you, more python you have to write, but more flexibility

Thanks for the answers. A few comments on whats been said so far.

1/ The reason for choosing Python is from asking a lot of people in the industry it seems to be the fastest growing language in banking/finance. My main priority is to enhance my own prop trading career, but would be good to "future proof my resume and Python will open the doors i want to walk through.

I think this is a very sensible approach. Ignore the language flame wars, I think for someone like you Python is perfect (but heck I'm biased).

GAT
 
Back
Top