Adventures in python and algorithmic trading

FXX

Experienced member
you will have more control if you learned a language like c# because you have ultimate flexibility. That being said a functional language is superior for this type of thing but much harder to learn. The beauty of a language like c# are frameworks like entity framework which makes integration with a database very easy and object oriented.

I was doing my algo in python then switched to c# and I haven't regretted this. I can rapidly explore ideas and build tools to make the exploration work of the algo much easier. For example, I have built a studio tool that integrates 2 different data vendors in a nice UI allowing me to both explore their data, ingest it with a few mouse clicks, and test the changes in the algo showing a chart with market data overlayed with the algo. I built this tool in 2 days and its so easy with visual studio and azure.
 

Trader333

Moderator
@FXX
I was doing my algo in python then switched to c# and I haven't regretted this.

I know this will be a rhetorical question but, in your view, how does learning c# compare to learning Python or Java ?
 

FXX

Experienced member
@FXX


I know this will be a rhetorical question but, in your view, how does learning c# compare to learning Python or Java ?
python is easier to learn. C# and Java are very similar so if you learn one you are well on your way to using the other, except there are differences in tools and how the frameworks operate. The hardest one I found learning was scala which is based off Java but a pure functional language (very powerful but not an easy learning path).

If you are new to all then python is a great starter with tons of libraries to make life easier.
 

Sharky

Staff
Hi Sharky. Interesting thread. I'm on a similar path but a ways behind you. I have started looking at Quantopian an python. Not too intimidated by that because I have been a dev. But it's the linking it all together bit that concerns be - all the different packages and components you namecheck above. I need it in a big diagram!
Anyway, question: have you come across many examples of folks using another dev took for automated algo trading? E.g. C++, C# or Java? Thre are also some drag and drop data manipulation tools I know which seem capable of the repeatable task of pulling candlestick data from an API, processing it for signals and dealing with the results. But I guess you'd have to do all your logic by hand whereas with the python world you have all these libraries and external services for all the signal stuff? I guess my basic question is: do I really need to learn python, or do I just need to program (and be able to architect a cloud solution)?
I do find it overwhelming as well, so I think your best bet is to decide on a path and try to stick with it. In my case, Python is the obvious choice, because as FXX points out it's easier to learn (it has a very natural syntax so it's easy to read), it powers Quantopian/Zipline which is probably the leading algorithmic community platform I'm aware of; and one advantage of this is that you can jump in their forums and browse a lot of shared code. It has tons of leading libraries like scipy, numpy and pandas; and is the leading language for machine learning (think tensorflow and sci-kit). If like me you're also interested in data science and web development, then you've got those covered too. Finally as someone who's really only looking at daily automated investing, I'm not missing the speed of compiled languages. I think you'd been fine even down to minute by minute intraday trading. If like me your time poor, then I think Python is a great all-round language if you had to pick just one.

The hardest part of all this is just keeping yourself motivated and progressing forwards, as someone getting into algorithmic trading without too much of a background in coding, then I think your best bet would be QuantConnect to be honest, they let you just jump straight into coding your strategy in either Python or C# and they handle the whole infrastructure side, running it in the cloud and enabled you to live trade with various brokers. Since like me you've got a bit of dev experience, then you can take the approach I'm taking and first learn the fundamentals of the language; to get a solid grounding - because I'm already comfortable with running commands in a linux terminal or say spinning up a virtual server.
 

Trader333

Moderator
Here is a 4 hour free course that I have been made aware of that some followers of this thread may find useful. It was put together by Nick McCullum who has worked as an investment analyst, portfolio manager, and software developer at financial startups for his entire career. He is known for explaining complex investment topics in a way that others can understand.
 
G

Guest36985

Here is a 4 hour free course that I have been made aware of that some followers of this thread may find useful. It was put together by Nick McCullum who has worked as an investment analyst, portfolio manager, and software developer at financial startups for his entire career. He is known for explaining complex investment topics in a way that others can understand.
I started watching the video then when I got to the bit where the best Algorithmic trading investment gurus were only making 50% return per year I thought it wasn't worth the effort!
😉
 

TickCOM

Active member
Thanks for the recent posts, I could share my thoughts but I don't think I've got much to add at this stage. My focus is definitely not get rich quick, what I'm attempting to do increase returns whilst reducing risk versus the 'market' by diversifying across asset classes and strategies - somewhat akin to building a mini hedge fund. I'm not shooting for astronomical returns, but if I can edge towards a 15% return a year, by taking an automated portfolio approach to investing that reduces risk and dreaded drawdowns then hip-hip-horrah! I don't plan to reinvent the wheel even, as 1invest pointed out QuantPedia is a great resource that's done most of the legwork for you in identifying tried and tested strategies. Along the way I hope to develop my python programming skills, better understand the whole algorithmic trading life cycle and finally get read and maybe put to good use a ton of trading and investing books I've picked up over the years.

Anyway, wanted to give a quick update, on progress in the last 3 weeks. So, it feels like it's been a bit all over the place, which probably reflects a) the fact that there's a ton of stuff to learn, b) there's no clear path to learn it, and c) we're all different, and we learn in different ways. Knowing myself I like to take a scattergun approach, which I need to be careful about, as I like to learn by touching multiple sources, but you can quickly become overwhelmed, so it's almost a psychological battle to feel like you're progressing at a rate, that keeps things interesting, makes you feel like you're progressing, whilst not quickly realising how much effort it's going to take.

I've come to the conclusion, that I only really need to know at this stage the basics of Python, and libraries like Numpy, Pandas, Matplotlib in order to feel comfortable reading algorithmic trading code. More important is choosing a path to the end goal which is live trading. Right now, I'm feeling good about using Zipline (open source Quantopian backtesting engine) running on QuantRocket on a cloud server, probably AWS. So my goal at the moment is to get my head around a few things 1) Quantopian/Zipline, meaning things like their Pipeline/Algorithm APIs primarily, as well as Pyfolio and Alphalens - these are all available on Zipline. To get off the ground I think it's helpful to start playing around with Quantopian, as you can immediately start coding and see the results, without worrying about configuring a local installation or getting the data you need. Then I plan to start playing around more Zipline to better understand the differences. 2) Trading Evolved book - my choice of Zipline has a lot to do with the fact that Clenow has chosen it for his book, so I plan to attempt to some of the strategies there up and running on Zipline myself, finally 3) QuantRocket - once I've got them running on my own local Zipline environment, I'll try moving these over to QuantRocket and attempt to live trade them with a paper trading account on IB (which I already have set up).

Before I got to this point, I was spending most of my time on Python learning, through a few sources:
  • DataCamp
  • SoloLearn
  • Real Python ebook
  • Various Printed Python Books I've accumulated over the years
I also started learning Flask (as a lightweight web framework) my thinking being to improve my Python I really need to get into a project that's going to interest me. Perhaps coding up a contest on T2W, as I know they're popular, but I quickly realised the time invested in that would right now be better served getting me nearer my immediate goals listed above, so give time is always a constraint, I'll put that on hold for now - but would live to come back to providing some tools or contests on T2W in due course.
Quantopian recently closed, was a 200M$ funding-no-issue company. The reason according to media was traders/developers were not able to develop anything useful ...

Good luck with the other alike platforms.
 

TickCOM

Active member
I started watching the video then when I got to the bit where the best Algorithmic trading investment gurus were only making 50% return per year I thought it wasn't worth the effort!
😉
Institutional typically trade with 5% of their assets, if the 50% is of the total assets they manage, then the return is 1000% of the traded volume.
 

Trader333

Moderator
Quantopian recently closed, was a 200M$ funding-no-issue company. The reason according to media was traders/developers were not able to develop anything useful ...

Good luck with the other alike platforms.
Could this be because being a good trader does not mean being good at coding and vice versa ? Also there is a need to have a strategy that is both profitable and programmable first before doing anything else.
 

TickCOM

Active member
Could this be because being a good trader does not mean being good at coding and vice versa ? Also there is a need to have a strategy that is both profitable and programmable first before doing anything else.
A good trader imply he is profitable. A good programmer is not as such related to profitability, where development of automated strategies is a big subject - but a list of fix points, you make your own conclusion:

- There is a learning curve, by programming 5-10 years with no guarantee of success.
- The first part may for some be to learn to program, and use the IDE - 1 year estimated.
- This learning curve is mostly try and error, to discover what is possible and what is not, why.
- 1000ś of programmers tried on Quantopian.
- There was high activity on LinkedIn algorithmic trading group three years ago, today there are zero - they gave up. They started around 2007, and in 2021 they are gone.
- Markets are today much more efficient than in 2007, and thereby more difficult to trade.
- Market behaviour now changes faster than strategies can be programmed/adjusted.
- Which imply technical trading and quant is replaced by "conceptual trading".
- Which imply an IDE need to have support for conceptual trading.
 

TickCOM

Active member
"Also there is a need to have a strategy that is both profitable and programmable first before doing anything else."

Not really, automated trading provide more sophisticated strategies, can span across more data than a human. Discretionary trading can be based on strategies which are almost impossible to implement in code.

It very much depend on the time-frame traded, the type of trader etc.

Lets say you have the perfect non-programming IDE for development, where the traditional learning curve can be cut to days/weeks, where you can develop portfolios of different kinds of conceptual strategies - would you use such, or sit day trading most of the day discretionary ?

Or you are a swing trader with a profitable strategy, but you have to be there most of the day not to miss opportunities, to take profit- letś say you could define your strategy, in a few minutes, which call you to the computer at promising moments- would you use it ?
 
G

Guest36985

"Also there is a need to have a strategy that is both profitable and programmable first before doing anything else."

Not really, automated trading provide more sophisticated strategies, can span across more data than a human. Discretionary trading can be based on strategies which are almost impossible to implement in code.

It very much depend on the time-frame traded, the type of trader etc.

Lets say you have the perfect non-programming IDE for development, where the traditional learning curve can be cut to days/weeks, where you can develop portfolios of different kinds of conceptual strategies - would you use such, or sit day trading most of the day discretionary ?

Or you are a swing trader with a profitable strategy, but you have to be there most of the day not to miss opportunities, to take profit- letś say you could define your strategy, in a few minutes, which call you to the computer at promising moments- would you use it ?
Utter nonsense. Give ONE example of a discretionary trading strategy that CAN'T be implemented in code.
 
G

Guest36985

To use your own polite words - "nonsense your self".
You cant back up your own claim, you are the one who is talking nonsense.
If what you say is true, explain it to everyone so they can understand, unless you lack the knowledge to explain it in which case you don't know what you're talking about.
 

Atilla

Legendary member
Utter nonsense. Give ONE example of a discretionary trading strategy that CAN'T be implemented in code.

This reference to what is a discretionary trade or not is a bit of a grey area.

If my feet are cold, I feel different about a trade than when they are warm...

Discretionary trade subjected to the whims of humanoids without a system is a big ask.

What does discretionary mean would be my question and how does one define that in programmable parameters?
 

new_trader

Legendary member
Utter nonsense. Give ONE example of a discretionary trading strategy that CAN'T be implemented in code.

Can't or almost impossible are two subtly different things. I'd say Tape Reading is one methodology that is almost impossible to code. Although self-taught, I'd say I am a fairly profficient coder in a number of different languages C#, Python, VB and I wouldn't even try to automate how I trade because coding would turn something 'fluid' into something 'crystallised' and that won't work.
 

sideways-sid

Active member
hello shark,

are you placing your first trades live yet?

He no longer needs to trade after you offered him $1m overnight!! :)

for your kindness and consideration, mr admin, mr shark, i hereby offer to you 1/1000th of one share of my soon to be forming trading company... each share will have a fixed face value of one billion dollars.

when my company is funded to the tune of one billion dollars, you may feel free to present a copy of this message and you will be paid 1/1000th of one share of my company or one million dollars. this is being done purely as a public relations move.
 

iq200

Well-known member
first, forget about C++.. it was an upgrade to C that never really got a foothold.. it complicates things unnecessarily. an entire trading system can be written in straight and pure C. so many people love their python, but it has weaknesses that are not desirable in a mission critical app like a trading bot.
C++ is not an upgrade to C. It is a separate language featuring more features such as OO but also supports C as well. However you can do pretty much anything in C++ that you could in C and much much more. C++ also has all the performance and features of C. This is why C++ is great demand in London.
I find you comment 'never really got a foothold' rather funny as pretty much most mission critical backend enterprise systems I have worked on were written in C++. For example the last software I worked on was a multi threaded enterprise risk management software consisting of 1million+ lines of code with the front end in c# and the back end written in unmanaged C++ for performance sold to banks and financial/trading institutions for six figures. Even today a lot of software where speed and performance is required are written in C++.
 
Last edited:

iq200

Well-known member
BTW I am not at all playing down C which is itself an awesome language and is used in compiler design courses in university courses to introduce students to the power of low level languages. However my point is only that you can actually code pretty much anything in C++ that you can in C.
 
 
Top
AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock    No Thanks