Git Product home page Git Product logo

pairs_trading's Introduction

Pairs Trading

I implemented the Pairs Trading algorithm in R. Pairs Trading is a stock market technique developed by Morgan Stanley in the 1980's. The idea is to collect past data for two stocks, acting as training data, that are highly correlated with each other. Since they are highly correlated, the ratio of the prices of the stocks remains around a constant value. Using this property, I buy and sell either stock depending on its position from the constant ratio value. For example, if the ratio of Stock A to Stock B is relatively high compared to the average ratio, then, since the stocks are highly correlated, we expect Stock B to begin to do better, relative to Stock A. This position at which I buy or sell a stock - the distance from the mean ratio - can be determined by optimizing the total profit yielded through simulation.

In pairs_trading.R are the functions used in my implementation of Pairs Trading. In simulation.R, I run simulations using the Pairs Trading functions to determine what stock characteristics appear to be most beneficial to the profitability of Pairs Trading. In writeup.pdf, I go in to more detail about my methods, and I give an in depth example.

pairs_trading's People

Contributors

jwnorman avatar

Watchers

 avatar  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.