Giter Site home page Giter Site logo

quantopian-hack-night's Introduction

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

quantopian-hack-night's People

Contributors

btmills avatar zbr-sol avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.