Code Monkey home page Code Monkey logo

stock-trading-bot's Introduction

stock-trading-bot

Stock trading bot written in python that evaluates active stocks and buy/sells undervalued and up-trending stocks based on day trading patterns and news sentiment analysis.

How does it work?

This code for this bot can be broken into 3 different parts:

  1. Web scrapes active stocks from yahoo finance.
  2. Evaluates active stocks (can evaluate 100s of stocks per minute as the application is multithreaded) using different strategies such as EMA crossovers/resistance breakthroughs, regression stock direction testing, and news sentiment analysis (buys and sells stocks based on quarterly earnings information or big news!).
  3. Evaluates current stock portfolio by checking if any stock no longer seems worth holding.
  4. Sends buy and sell requests using the alpaca paper trading api

That's it!

Why create and use a stock-trading-bot

  • Evaluates good opportunities faster than a human can by evaluating multiple stocks simultaneously.
  • Takes the emotions out of the equation.
  • No time commitment after the bot has been setup.
  • It is fun lol ๐Ÿ˜„

How to use it

  • Clone the repository: git clone https://github.com/aoberai/stock-trading-bot.git

  • Install dependencies pip3 install -r requirements.txt for linux bash py -m pip install -r requirements.txt for windows command prompt

  • Add a credentials.py file which has the information to your api keys / passwords 1)Alpaca api for stock buying and selling handler + front end : https://alpaca.markets 2)News API for stock sentiment analysis : https://newsapi.org

  • Put the following 3 variables into your credentials.py file:


  • ALP_API_ID=""
  • ALP_SECRET_KEY=""
  • NEWS_API_KEY=""

  • Run the runner.py file!

How to run in docker

docker build -t stock-trader-bot .
# you can change the timezone to be region specific
docker run --rm -it -e "TZ=America/New_York" -d -p 5000:5000 stock-trader-bot

Please create an issue if you are having problems getting the repo to work or if any part of the codebase look confusing -- I can help out.

To do List

  • Add more trading strategies to ensure better returns.
  • Refine buy and selling time
  • Differentiate between long term and short term day trading positions

This repository is constantly getting better so please feel free to work with it and post pull requests if you encounter any bugs or want to add additional functionality.

by Aditya Oberai

stock-trading-bot's People

Contributors

aoberai avatar bigdeveops avatar dependabot[bot] avatar faisalnwz01 avatar adityaprakash-26 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.