Giter Club home page Giter Club logo

stable-alpha's Introduction

Stable Alpha

The goal of this repository is to create a portfolio with equivalent risk and higher returns than the S&P using quantitative, automated trading strategies

Background

The S&P 500 index fund is a widely accepted stable and long term investment. Due to the continued growth of US companies, it also yields decent annual returns and is often used a benchmark for judging other investments. Thus, investors in S&P 500 index funds can take on a very passive role.

For investors seeking greater returns, however, alternatives are typically much more volatile and risky, thus requiring more active management. For example, investors in ProShares UltraPro S&P 500 fund, which is a 3x leveraged ETF tracking the S&P 500 index, experience 3x gains during periods of upturn, but also 3x losses during periods of downturn.

Investment Thesis

To mitigate the volality of the ProShares UltraPro S&P 500 fund, I propose identifying an indicator of significant downturns and automatically moving assets from the ProShares UltraPro S&P 500 fund to stable assets like gold and bonds in the prescence of this indicator.

One potential such indicator is short term, rapid downturn which will likely be followed by further losses. My work in the "Code" section will describe how I statistically verify and optimize this indicator.

Trading Platform

The trading platform I will be using is Composer. This online trading platform allows users to construct simple automated indicators for executing trades. Since I am limited in the types of indicators I can use, I decided to verify and optimize a conditional indicator of the following form: "IF MAX DRAWDOWN OVER x DAYS > y%". If this conditional is satisfied, the platform will automatically trade all shares of the ProShares UltraPro S&P 500 fund to the aforementioned stable assets. In particular, it will invest in: 25% GLD, 25% TIP, 25% IEI, and 25% BSV.

Code

To verify and optimize this indicator, I collected historical data on the ProShares UltraPro S&P 500 fund from 2009 to present day, using data from 2009 to 2020 to train/optimize the indicator and setting aside data from 2021 to 2022 as a holdout set to verify its strength as a trading signal. I then identified significant drops in the price of the fund over these dates using signal analysis libraries on scikit-learn. Then, I performed a grid search over the two parameters of interest: 1. Day Ranges: 5-100 days in increments of 5 days 2. Percent Drop Threshold: 1-24% in increments of 1%. I calculated the balanced accuracy score of each of these pairs of parameters with the true labels for major drops and then selected the highest scoring pair. Finally, I verified its balanced accuracy on the holdout set.

Performance

See backtested performance as compared to the S&P 500 index fund and the ProShares UltraPro S&P 500 fund on Composer: https://app.composer.trade/symphony/UmPd8GAt8sixWkBTfm9q

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.