Skip to content

A simple yet robust API client for Robinhood

License

Notifications You must be signed in to change notification settings

k3an3/fast_arrow

 
 

Repository files navigation

fast_arrow

A simple yet robust API client for Robinhood

Build Status   Coverage Status   Version

example

from fast_arrow import Client, Stock, OptionChain, Option

#
# Oauth2 authenticate with Robinhood
#
client = Client(username=username, password=password)
client.authenticate()

#
# fetch the stock info for TLT
#
symbol = "TLT"
stock = Stock.fetch(client, symbol)

#
# get the TLT option chain
#
stock_id = stock["id"]
option_chain = OptionChain.fetch(client, stock_id)

#
# let's get TLT options (calls and puts) for next 4 expiration dates
#
oc_id = option_chain["id"]
eds = option_chain['expiration_dates'][0:3]

#
# get all options on the TLT option chain
#
ops = Option.in_chain(client, oc_id, expiration_dates=eds)

#
# merge in market data fro TLT option instruments (ask, bid, delta, theta, etc)
#
ops = Option.mergein_marketdata_list(client, ops)

install

Install the package from pypi,

pip install fast_arrow

design principles

You might be asking, "yet another Robinhood client? There's already a few out there. What's different about this one?"

fast_arrow holds to these design principles,

  1. focus on simple features that expose data. Don't interpret data.
  2. make stock & option operations easy to talk about and do with code
  3. organize code in small and discrete python classes

features

Here's what you can do with fast_arrow (some features still in development)

Stocks

  • get quotes
  • fetch historical data
  • fetch all stock trades
  • submit orders
  • fetch earning events (past and future)
  • fetch company news articles
  • fetch company fundamentals
  • fetch popularity data

Options

  • fetch option quotes (example)
  • fetch open option positions (example)
  • fetch all option orders (filled, canceled, rejected)
  • fetch historical options data (example)
  • fetch option events (example)
  • generate option strategy orders
  • generate humanized names for option strategies
  • submit order (example)
  • cancel order (example)
  • replace order (example)

Portfolio

Authentication/Security

  • handle standard Login/Logout flow example
  • handle MFA token during login example
  • pin SSL certificate (see this PR)
  • automatically refreshes oauth2

Want to propose a feature? Open a feature request or open a Pull Request.

development

Install pipenv, and then run,

pipenv install --dev

Run the test suite via,

make test

Run all the examples (make sure you add username/password to config.debug.ini),

sh run_all_examples.sh

Run the test suite against a specific python version,

pipenv run tox -e py36

releases

Adding so I don't forget the next time I release a version,

python setup.py sdist bdist_wheel
twine upload dist/*

projects using fast_arrow

About

A simple yet robust API client for Robinhood

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 53.7%
  • Python 45.9%
  • Other 0.4%