Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
When you first came across Quantopian, how did you learn the basics?

I've been aware of quantopian for a while now, but I'm having trouble learning the very basics... Any advice?

8 responses

Well, you need to know some programming first (I assume that's your problem here). I'd suggest something like codecademy.com to learn the basics of Python and then come back here to apply what you learned there.

Do you have any background in programming? If not, learn Python first and then come back. coursera has a course just now:

https://www.coursera.org/course/interactivepython

It is free and easier than doing on your own.

A while ago, I taught myself php and, as far as I can tell, Python seems very similar. I do need to learn python, but the thing I don't understand is how you guys know what variables are 'programmable' (not sure if that's the right word). I can't imagine that knowing python is enough, surely this involves having a far more in-depth knowledge of finance orientated code, not just a general/overall knowledge of the language? Sorry if my 'newbie' posts are frustrating for you guys! :/

I first read about Quantopian on Barron's and have been trying to learn it but progress is slow and almost non existent. I am very old school, and last time I had to do programming for a living was in 1996. Programming language wise, I know Fortran, Basic, Pascal and C. Trading system wise, I know how to program Wealthlab, Metatrader, Neoticker and some EasyLanguage. In each of the trading system programming languages, I picked up examples and read them along with the documentation available and figured my way. Actually, I have done some system programming in Wealthlab and Metatrader and got paid for it. Working with professional traders made me realize that most profitable trading systems are simple, need to be fault tolerant (eg. handle bad data, no fills etc.), require robust computing and internet connection along with adequate capitalization. Apart from confidentiality agreements and even though I am allowed to trade the systems with my own money, most (if not all) of the systems I wrote for these traders needed a lot of capital to trade.

Anyway, I am sorry to say but two things are working against me here - 1. My lack of understanding the Python language and 2. The lack of properly and lucidly written documentation of Quantopian functions, systems etc. To me, it is written with the techie in mind, and not for a trader. Writing trading systems maybe fun and instructive for many, but the basic goal is to help develop mechanical trading systems that ultimately will help us make money trading, hopefully :)

I hope Dan and Jess don't take my criticism in the wrong way, but realize that it is a plea from an user to make the documentation more user friendly.

Joshua - I've been watching this one, wondering what kind of advice you'd get!

Here's what I'd suggest. Start with one of the webinars. I'm doing one on Thursday morning, and you can see one from last month on YouTube. If those are too long, there is a 4-minute version and a 30-second version. All of those videos are aimed at getting you familiar with the sample algorithm. If you're stuck on the sample algorithm, let's figure out what's going on. It might be that more Python learning is in order.

Next, I'd just read the documentation. You'll skip through parts of it, I'm sure. But if you understand what 80% of the items are, you're going to have a good idea of what tools are in your tool box. Ameritendu's advice is well taken, we need to make the documentation easier to understand. Still, it's the best tool that we have so far. I'd take some of the examples we have written at the bottom of the help doc and run them as algorithms. Edit them, add logging, add record() lines so you can understand what they do.

Then, you really need a test project. Maybe a pair trade, maybe a momentum play, maybe something using Fetcher. You need a goal. Write up the overall plan. What's your data source? What's your trade signal within the data source? How will you know what your in and out triggers are? Then, write the code to implement that plan. If you get stuck, this community is the place to find help.

I'm very interested if these steps get you going, and if not, where you find yourself getting stuck.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hello Joshua,

Copy a simple algo and use lots of print statements - as much are allowed by the annoyingly small 2+20 limit. Try stuff like this:

def initialize(context):  
    context.stocks = [sid(2), sid(24)]  
    context.start = True

def handle_data(context, data):  
    if context.start == True:  
        # if context.start: if you prefer that  
        print context.portfolio.cash  
        print context.portfolio.capital_used  
        # print some other stuff  
        context.start = False  
    for sid in context.stocks:  
        print sid  
        print sid.sid  
        print data[sid].close_price  

Get the indentation wrong. Type '=' instead of '=='. Experiment. Think about the idea of an object that has propertes in the 'dotted' form of object.property i.e.

sid.sid  

is the worst possible example I could use but it denotes a 'security' object called anything (in this case 'sid') with a property (always) called 'sid. Some objects have 'methods' that will be invoked with parantheses i.e. '(' and ')' but sometimes these will be empty i.e. myDataFrame = pandas.DataFrame(). You will confuse lists with dictionaries with indexes with function calls i.e. any of {}, () and []. Just have a play.

Hello Maji,

Email me. We should collaborate on something.

P.

This is how I learned...

  1. Try, try, and try again. Nothing beats sweat and tears as a learning experience.
  2. Comment your code. If you clone another's code, go through each line and write a comment about it.

  3. If it fails, search online for a solution (either it's a python issue, or a quant issue... either way, you'll find a solution out there).

  4. If it succeeds, try to break it... then figure out why it broke.

  5. Read everything you can. Look at every algo you find, and try to find the similarities / differences.

  6. If you don't understand the output, print or record it.

  7. Don't worry about Python... it's just a language... understand the process first. Ordering a cheeseburger in French is just the same process as you would in English, it's just different words to command the process.

  8. Print out snippets which you think you'll use often. Keep them in front of you, and a second copy under your pillow when you sleep.

Last but certainly not least...
9. If you have a problem or need help thinking out a solution, reach out to the community... everyone's been real friendly and helpful here!

Documentation is overall pretty good here. Keep a list of where stuff is coming from... does a command or variable come from the quantopian definition, is it a python command, or some other imported library? Then goto that reference and read, try, fail, fix, try to break, and fix again.

Best of luck... You'll get up to speed in no time!
-mc

@Dan Dunn the video links are marked as private on youtube. Could you please provide some links to the basics.

I have coded on C++, Java in the past. very little exposure to python. I have a trading strategy, but am failing at making it into an algo. Any pointers will be greatly appreciated.