I have been asked multiple times lately, by various different people, as to whether I could write a blog post about how I got from where I started (someone who had never coded before at all), to where I am now (someone who’s still firmly in the “learning” camp, but able to create a range of semi-useful code snippets).
Those asking pointed out that although it was relatively interesting and fun reading my posts while following along, replicating my code line for line and then running the script to get their output, my posts weren’t great at actually helping people develop the necessary skills and knowledge to be able to branch out and create their own mini-programs and projects. Nor did I tend to point readers in the right direction of the actual resources that I myself had used and found useful to develop as a Python programmer.
I totally take this on board, and appreciate there is a fundamental difference between just presenting my own mini-projects in blog posts and inspiring/helping others to be able to identify and create their own mini-project“wish-list”.
So with that said, here is my (first) attempt to rectify that situation and blog about slightly more “meta” topics, related to the process of learning Python, rather than Python itself.
It seems like as good a place as any to begin by recounting my own experience of the learning process, as after all I did start right at the beginning with literally zero knowledge or exposure to any kind of coding or programming, save for perhaps a few attempts at using the “Macro Recorder”in Excel and then trying to decipher the related code output in the VBA Editor.That was back around 2007.
Suffice to say those “attempts” weren’t exactly fantastically successful. I eventually managed to hack together a couple of “working”macros (and I use the term “working” rather loosely!) that automated a small number of simple, but repetitive Excel tasks I was responsible for carrying out on a daily basis.
Looking back, the actual code that made up the macros was absolutely horrific, and really would have made any programmer worth his salt despair – but to me it seemed like magic!!! I have to admit I spent an embarrassing amount of time resetting and replaying my macro, just to see it work that “magic”again and again – “Happy with myself” was an understatement.
Well that was quite a few years ago, and it wasn’t until much later in early 2013 that circumstances lead me back toward the world of coding and programming.
I have spent the entirety of my career (about 16 years) involved in the financial markets, with the vast majority of that time (around 15 years)spent working as a trader on various trading desks in the City of London. I won’t bore you too much with the detailed ins and outs of my career history, but I mention it to highlight the fact that in 2013 I started a new job at a London based CTA firm, which specialised in systematic/algorithmic mean-reversion trading strategies executed almost exclusively on the large, liquid index futures markets (e.g. Eurostoxx50, S&P500 etc).
Previous to joining that CTA, I had almost exclusively worked in trading environments that could be described as “discretionary”. To highlight the main difference between “systematic” trading and “discretionary”trading as a fundamental ethos the main points should be noted:
- With discretionary trading each buy and sell decision is made subjectively by (or at the “discretion” of) the fund/portfolio manager based on their interpretation of current market conditions. This means trade logic can deviate substantially from one trade to the next.
- With “systematic” trading strategies a set of concrete“rules” are defined and then often converted into a computer algorithm that is then fed historical pricing data to “backtest” the strategy logic in an attempt to identify a profitable set of rules. Once a satisfactory algorithm has been identified and defined, it is then followed as objectively as possible allowing the “system”to dictate trading activity to be followed as closely as possible.
So what has all this got to do with learning Python you ask?Well as soon as I saw how systematic trading strategies could be coded up and backtested, I was completely hooked! It was like my eyes had been opened to a whole new world of trading that I had no clue really existed until then – a complete paradigm shift.
Seeing all this going on around me, I so, SO wanted to be able to design and back-test my own trading strategy – it suddenly became an all-consuming mission to get where I needed to be.
The point of all this background waffle boils down to this –you need to REALLY want to learn to code if you’re going to give yourself a decent chance of success in your journey. This stuff is hard!! Don’t believe anyone who tells you any different…There are going to be times when you just feel completely out of your depth and defeated and it’s at those times you need to be able to draw on that overwhelming desire to succeed. But I’ve yet to meet anyone who is THAT passionate about “coding” in and of itself – the passion is really to be found in the desire to use your coding skills to BUILD something or CREATE something that means something to you personally.
If I can give one piece of advice to anyone starting their journey, it is this – think about what you want to eventually use your newfound skills to create. Think until you have something in your mind that excites you enough to keep you focused through the hard/frustrating/demoralising times ahead – and those times WILL come, trust me!
It could be building your own personal web site and blog, it could be creating your own adventure game (text based or with graphics),perhaps designing and coding your own trading strategy with corresponding system to generate and display in-depth performance reports. Basically it can be anything that means something to YOU, something that gets your juices flowing just by thinking about it and imagining how you’ll feel when you finally achieve it.
I’m not a “wishy-washy, touchy-feely” kind of guy, but in this case I cannot overestimate the value of having that end goal in mind and nurturing the corresponding feelings and emotions that come along with the thought of success in that goal.
When you have chosen your desired project, please do leave a comment in the comments section below and tell us about your idea – it’s always useful to hear about other people’s plans and thought processes. Tell us what your project is, and why you chose it – why you have such a strong desire to create it and how do you plan getting from “here” to “there”. I really do urge you to leave a comment so we can help you start your journey on the right foot.If I can I will recommend some useful learning resources, tailored to your specific project!
Ok, that’s enough of the focus on emotions and feelings…probably time to get a little more practical!
So you’ve decided you want to build something, you’ve decided that you want to build that thing in Python and so you sit down at your computer screen and…well, you suddenly realise you don’t really have a clue what to do next. Don’t panic!! I know the feeling – I was right where you are when I started.
On day one, if I recall correctly I somehow landed on the codecademy.com website, and saw they offered an introductory Python course. I remember it being relatively entertaining and did a good job of hand-holding most of the time, with the odd “harder” exercise thrown in here and there that took me a day or so on occasion to solve/complete successfully. What I didn’t realise was that the whole Codecademy experience takes place in their “sandboxed”environment – they use technology which allows all the python code to be created/tested/executed within your browser, negating the need to actually download, setup and run Python on your local machine.
This is all well and good, and I understand why it is designed this way to offer ultimate ease of use and minimal barriers to entry,but for me it worked as a negative in my learning journey. I was at a stage where I didn’t know what I didn’t know – and I didn’t even realise I was trapped in their sandbox…
As soon as I closed my browser and tried to “do” Python on my own, I was even more confused than when I started. Codecademy does nothing to help you with the initial set-up stage, nothing to help you contextualise the Python environment and ecosystem and how you create, store and run “real”python files. It conveniently omits anything that would tend to lead you away from their little closed browser based environment. Combined with the fact that there seems to be almost no courses offered that are accessible without paying for the “Pro” version anymore, I would recommend giving Codecademy a pretty wide berth!!!
One of the things that I learnt over time, was that for every paid course online promising to teach you Python, there was an equally good resource available for free that offered just the same quality and depth –all you have to do it dig around a little bit (and honestly most of the time you hardly have to dig at all – there are that many quality free resources).
A great source of structured Python courses that I gravitated toward quite early on in my journey was the various MOOCs offered online by various academic institutions and universities. MOOC stands for “Massive Open Online Course” and they can be found through the main MOOC providers –namely Coursera (www.coursera.org), Udacity (www.udacity.com)and EDX (www.edx.org).
The first couple of courses I enrolled on were provided by Coursera and they were:
- Programming for Everybody (Getting Started with Python) – University of Michigan
- An Introduction to Interactive Programming in Python (Part 1) – Rice University
It was a few years ago since I took them, but if my memory serves me correctly, I recall both of them being a great starting point and foundation that I was able to build upon in the forthcoming months. They both did a great job of starting right at the very basics, easing you through the Python installation and setup process, helping explain how the different moving parts (Python language itself, the IDE or “Interactive Development Environment”,the command line terminal etc) fit together to form the “coding environment” that,if used correctly, would allow you to create and run any imaginable program you could create with Python.
Some of the earlier sessions and exercises felt a bit on the easy side (especially with the Programming for Everybody course), but there was plenty to keep me busy in the latter stages of both courses. I remember battling with one of the later assignments from the Rice University course,where we had to design and code a “Rock, Paper, Scissors” game – but this time it was the “Rock, Paper, Scissors, Lizard, Spock” game. I got completely stuck on how to join up the cyclical nature of the scoring system whereby each option can always be beaten by the option to it’s left. I could get it all to work except for that issue. Looking back it’s a rather trivial problem to solve, but at the time it drove me crazy.
If anyone cares, the solution to the problem lay in the use of the “modulo” operator. I’ll leave it at that in case I risk spoiling the fun for anyone who takes the course and tries the problem for themselves…
So to quickly recap the main points so far:
- It is VITAL to identify and select a project you wish to eventually create – something that really means something to you and excites you when you think about it.
- Steer clear of Codecademy as an early Pythonresource – Most of it is now behind a paywall and the whole concept of trapping you inside their sandboxed environment can end up causing added confusion rather than helping.
- Consider signing up to a quality MOOC beginner Python course – my recommendations are the two listed above (I’m sure there are many other quality courses on offer out there, but those are the two I have experience with and they both did a good job of getting me from zero to “absolute beginner”.
I think I’ll leave it here for the moment, it seems like it might be best to break this blog topic into a few consecutive posts to reduce the risk of anyone dying of boredom!
In the next instalment I’ll move on through my own learning time-line with suggestions/recommendations etc thrown in here and there for good measure. I hope this post hasn’t been too “waffly” – I appreciate it’s a fine line when writing about subjective experiences and such. If anyone fancies commenting below with details of their pet project ideas and details of what they want to build and why , that would go a LONG way towards validating this post and the deviation from “coding” articles for the addition of a more subjective piece.
If people just downright hated this wall of nonsense, do also feel free to let me know – feedback is always appreciated, good of bad!
Till next time…