Skip to content

drivecapital/quantopian-hack-night

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 

Repository files navigation

Hack Night + Quantopian

Background-info

What is a trading algorithm?

Algorithmic trading is a method of executing a large order (too large to fill all at once) using automated pre-programmed trading instructions accounting for variables such as time, price, and volume to send small slices of the order (child orders) out to the market over time. They were developed so that traders do not need to constantly watch a stock and repeatedly send those slices out manually.

On Quantopian, a trading algorithm is a Python program that defines two special functions: initialize() and handle_data(). initialize() is called when the program is started, and handle_data() is called once per minute during simulation or live-trading in events that we'll refer to as 'bars'. The job of initialize() is to perform any one-time startup logic. The job of handle_data() is to decide what orders, if any, should be placed each minute.

The following is an example of an algorithm that allocates 100% of its portfolio in AAPL:

def initialize(context):
    # Reference to AAPL
    context.aapl = sid(24)

def handle_data(context, data):
    # Position 100% of our portfolio to be long in AAPL
    order_target_percent(context.aapl, 1.00)

Start writing code

Home page of algorithms (check out the Hello World Algorithm first) - https://www.quantopian.com/algorithms/

Check out the examples folder here

I've provided a few simple examples of algorithms I've built/tested using some well known stocks.

See how high (or low!) of a return you can get.

Slightly more advanced - Pipeline concept (copied from https://www.quantopian.com/help#pipeline-title)

Many trading algorithms are variations on the following structure:

  1. For each asset in a known (large) universe, compute N scalar values for the asset based on a trailing window of data.
  2. Select a smaller “tradeable universe” of assets based on the values computed in (1).
  3. Calculate desired portfolio weights on the trading universe computed in (2).
  4. Place orders to move the algorithm’s current portfolio allocations to the desired weights computed in (3).

The Pipeline API module provides a framework for expressing this style of algorithm.

Prizes for the ambitious

  1. Highest-returning algorithm (must use at least some sort of methodology beyond "Buy a bunch of Apple")
  2. Same as above, except lowest returning algorithm
  3. "Judges favorite" (up to the discretion of Zach & Brandon). As an example, Zach had great idea (aka lost A LOT of money) to just consistently short Amazon and buy Sears...he may have been on the wrong side of retail history.

Support Links

Quantopian-specific
General

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published