Giter VIP home page Giter VIP logo

alpaca-erasure's Introduction

Alpaca - Erasure

This script is an example code that calcualtes stock scores every day using latest price data. With the output of this script, you can build daily rebalancing long-short algorithm.

The score is calculated using exponential weighted moving average with span=10, and take the difference from last day closing price. The value range is between 0 and 1 with 0 being most overvalued and 1 being most undervalued. For more information, please take a look at the reference below.

How to

Install alpaca-trade-api

$ pip install alpaca-trade-api

and run erasure.py

$ python erasure.py

It outputs something like below.

...
PFIE,0.5015664246239445
PFIS,0.4997877550102791
PFNX,0.4768029748467622
PFPT,0.500816891906715
PFS,0.5010411315523059
PFSI,0.5053465393041152
PFSW,0.5149531269639088
PG,0.49686832450835694
PGC,0.5057306188423834
PGNX,0.4998828329411989
PGR,0.498740133468462
PGRE,0.5007967622834778
PGTI,0.5019629289791301
...

Reference

The part of scoring logic was extracted from Alpaca tutorial algorithm

alpaca-erasure's People

Contributors

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