Git Product home page Git Product logo

stock_api's Introduction

Introduction

This script uses the Interactive Brokers API to implement a trading algorithm. The algorithm uses data from the Yahoo Finance API and two different trading strategies:

Usage

to clone this project, on your terminal run git clone https://github.com/dafrabzinator/STOCK_API.git. after the cloning process is complete, navigate into the project directory.

here are some of the python packages specified in the requirements.txt file

  • http
  • ibapi
  • yfinance
  • pandas
  • numpy
  • matplotlib
  • ib_insync

run pip install -r requirements to install all the required packages in your python environment. you can then execute the script.

Functions

  • get_stock_data(ticker).
  • should_buy_or_sell(data).
  • moving_average_crossover(data, short_window, long_window).
  • bollinger_bands(data, window, num_std).

the get_stock_data(ticker) function takes a ticker symbol as input and returns a pandas dataframe with the stock's historical data. the stock data

should_buy_or_sell(data) This function takes a pandas dataframe as input and returns a boolean indicating whether to buy or sell the stock based on the implemented trading strategy.

moving_average_crossover(data, short_window, long_window) This function implements the Moving Average Crossover strategy. It returns a boolean indicating whether to buy or sell the stock.

bollinger_bands(data, window, num_std) This function implements the Bollinger Bands strategy. It returns a boolean indicating whether to buy or sell the stock.

Disclaimer

Please note that this script is for educational purposes only and is not intended for use as an actual trading algorithm. Trading in the financial markets carries a high level of risk and is not suitable for all investors. Before making any investment decisions, it is important to carefully consider your investment objectives, level of experience, and risk appetite.

Author ๐Ÿ“

follow me on

stock_api's People

Contributors

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