GithubHelp home page GithubHelp logo

pnoch / nexttrade Goto Github PK

View Code? Open in Web Editor NEW

This project forked from austin-starks/nexttrade

0.0 0.0 0.0 52.1 MB

A system that performs algorithmic trading

License: MIT License

JavaScript 0.78% TypeScript 98.95% HTML 0.26%

nexttrade's Introduction

NextTrade - Plan your next trade

A system to create, test, optimize, and deploy algorithmic trading strategies.

Read More about it here

For a fully functional platform, check out NexusTrade. NexusTrade is a AI-Powered automated trading and investment platform that allows users to create, test, optimize, and deploy algorithmic trading strategies. It's faster and more configurable than NextTrade and easier to use.

Features

  1. Combine conditions to form compound conditions. Combine compound conditions and create trading strategies.
    • For example:
      • Condition A: QQQ stock is 1 SD below its 5-day mean price
      • Condition B: Buying power is above $8,000.
      • Condition C: Condition A and condition B
      • Strategy: If condition C, buy $3000 of SPY
  2. Create unlimited portfolios with different combinations of strategies
  3. Backtest those strategies using historical data.
    • Only stocks are currently supported, but cryptocurrency and options support is baked into the architecture
  4. Optimize the strategy's parameters using a genetic algorithm
    • Choose hyperparameters like mutation rate, training period, validation period, and population size
    • Choose to optimize percent gain, sortino ratio, sharpe ratio, or max drawdown
  5. Deploy the strategies live and see how it performs in real-time

System Architecture and Design

Some architectural artifacts can be found at this link: https://drive.google.com/drive/folders/1TgZNGPd7TBWi47dWh0TI2nZ_9WUhv_P_?usp=sharing

Local Installation

Prerequisites

  1. Mac, Linux or WSL2 preferred
  2. Tradier Account (with at least a free sandbox token; additional brokers TBD)

Mac Setup

  1. Clone the repository.
  2. Install MongoDB community edition and enable it.
  3. Install the dependencies: npm run install-all
  4. Make sure all tests pass: cd app && npm t && cd ..
  5. Add your Tradier token to the ./app/env file and rename the file to .env

Linux/WSL2 setup (tested on Ubuntu 20.04)

  1. If needed, install Node.js. NVM Option:
    1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    2. Exit and restart the terminal session.
    3. nvm install --lts
  2. Install MongoDB community edition and enable. For Ubuntu 20.04:
    1. curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    2. echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
    3. sudo apt update
    4. sudo apt install mongodb-org
    5. Linux/Ubuntu specific:
      1. sudo systemctl status mongod (verify it's running)
      2. sudo systemctl enable mongod (to auto-start at boot)
    6. WSL2 specific:
      1. sudo mkdir -p /data/db
      2. sudo chown -R `id -un` /data/db
      3. wget -O mongod.sh https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d
      4. sudo mv ./mongod.sh /etc/init.d/mongod
      5. sudo chmod +x /etc/init.d/mongod
      6. sudo service mongod start
      7. sudo service mongod status (verify it's running)
    7. mongo --eval 'db.runCommand({ connectionStatus: 1 })' (verify it's working)
  3. Clone the NextTrade repository: cd ~ && git clone https://github.com/austin-starks/NextTrade && cd NextTrade
  4. Install the dependencies: npm run install-all
  5. Copy the sample config file to .env cp ./app/env ./app/.env
  6. Add your Tradier token to the ./app/.env file
  7. Make sure all tests pass: cd app && npm t; cd ..

Turning on the system

Manually managed

Development environment

  1. Open two terminal windows.
  2. In a terminal instance, turn on the client: cd client; npm start
  3. In another terminal instance, turn on the server: cd app; npm start
  4. Once started, load the app: http://localhost:3000

PM2 Managed

Setup

  1. npm install pm2@latest -g
  2. cd ~/NextTrade/client && pm2 start npm --name "NextTrade-Client" -- start
  3. cd ~/NextTrade/app && pm2 start npm --name "NextTrade-App" -- start
  4. pm2 save

Running (assuming no other PM2 apps)

  1. To start the client+app: pm2 start all
  2. To stop the client+app: pm2 stop all
  3. Other Useful commands: pm2 status, pm2 logs, pm2 monit See PM2 Quickstart for more.

nexttrade's People

Contributors

austin-starks avatar rgreer4 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.