Git Product home page Git Product logo

alpacahq-python-sample's Introduction

alpacahq-python-sample

A simple python project to get you started on alpaca APIs.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

alpaca-trade-api-python is a python library for the Alpaca Commission Free Trading API. Note that this package supports only python version 3.7 and above.

Install the latest Python >= 3.7.

Install the pandas, numpy, scipy, websockets packages.

pip3 install pandas numpy scipy websockets

Install the alpaca-trade-api package.

pip3 install alpaca-trade-api

Setup the API KEY_ID and SECRET_KEY

  1. Get the API Key & Secret from Alpaca.

  2. Set the API_KEY & API_SECRET values in trade.py & websocket.py.

Run the project

To run the trade service

python trade.py

To run the websocket service

python websocket.py

References

In the examples folder there's a few algorithms that connect to the paper-trading API.

  • Long-short equity strategy
  • Martingale strategy

In the websockets folder there's examples to do the following:

  • Different subscriptions(channels) usage with alpaca/polygon streams
  • Pause / resume connection
  • Change subscriptions of existing connection
  • ws disconnections handler (make sure we reconnect)

Built With

Contributing

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the Apache License License - see the LICENSE file for details

Acknowledgments

alpacahq-python-sample's People

Contributors

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