GithubHelp home page GithubHelp logo

tonysun2 / intro-to-algotrading-workshop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bruinquants/intro-to-algotrading-workshop

0.0 0.0 0.0 5.59 MB

License: MIT License

Python 0.13% Jupyter Notebook 99.87%

intro-to-algotrading-workshop's Introduction

Algo Trading and Data Analysis

How to get started

Make an account with Alpaca. It's the free API we'll be using that allows us to fetch historical data, place orders into a paper trading account, and test our algorithm using live market data.

You'll need to generate your API keys, which tells the server that we're allowed to use it. Place the key and the secret key in their respective places in the config.py file.

You will probably find it easier to use conda for package management.

Once that is set up, run pip install -r requirements.txt from the terminal in your conda environment to install all the packages.

API interface

The setup_requests.py file provides the basic interface to interact with our API. We can get the information about our account, see our portfolio, and place orders to our paper trading account. See the documentation for extensive details about the response schema.

If you have everything setup and running correctly you should be able to run the setup_requests.py file and see 1 share of Apple now in your portfolio. The order might not fill immediately if you place the order outside of market hours.

Getting historical data

Fetching historical data is slightly inconvenient in Alpaca since it operates on the older v1 API, so we lose some nice functionality from the requests module. The functions get_historical_data and make_dataframe serve all of our desires to get historical data, quickly benchmark ideas, and run basic backtests.

This should be everything we need right now

Important note: make sure to remove your API keys from the config.py file before pushing. You don't really want that stuff floating around on the internet.

Websocket streaming for live data

Pairs Trading and Time Series Analysis

intro-to-algotrading-workshop's People

Contributors

colinpcurtis avatar jjchoi3 avatar bruinquants 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.