Skip to main content

A simple yet robust API client for Robinhood

Project description

fast_arrow

A simple yet robust (stock+options) API client for Robinhood

Build Status   Coverage Status   Version

PLEASE NOTE - breaking changes introduced in 1.0.0 release

Sometime during Spring 2019, Robinhood changed how their API handles authentication. In order to adapt to those changes, I've moved "authentication" outside this library to fast_arrow_auth, https://github.com/westonplatter/fast_arrow_auth.

Please see:

  • issue 35 for a detailed account of the issue
  • this comment for the approach I've taken to remediate auth issues
  • this PR for a run down on exact code changes

I have released these changes under version 1.0.0 to follow semantic version guidelines (since auth changes are incompatible API changes).

example

from fast_arrow import Client, Stock, OptionChain, Option

#
# new auth process as of 1.0.0
# get auth_data (see https://github.com/westonplatter/fast_arrow_auth)
#
with open("fast_arrow_auth.json") as f:
    auth_data = json.loads(f.read())

#
# initialize client with auth_data
#
client = Client(auth_data)

#
# 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,

  • focus on simple features that expose data. Don't interpret data.
  • make stock & option operations easy to reason through & execute with code
  • organize code in small and discrete python classes
  • use fast_arrow_auth to handle authentication process

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

  • fetch historical value of portfolio (example)

Authentication/Security

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/*

supporting libraries

projects using fast_arrow

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_arrow-1.0.3.tar.gz (155.8 kB view details)

Uploaded Source

Built Distribution

fast_arrow-1.0.3-py3-none-any.whl (163.1 kB view details)

Uploaded Python 3

File details

Details for the file fast_arrow-1.0.3.tar.gz.

File metadata

  • Download URL: fast_arrow-1.0.3.tar.gz
  • Upload date:
  • Size: 155.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for fast_arrow-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7ffaa7860fcd1f003c2dc7bbce1e4babbd02837ffba3c99ba3e4f4f084006a42
MD5 96cc1cbb20e9a50be51c4231d67bfc52
BLAKE2b-256 4694c903e7248593efe137ff7b1b83a166404d9e8567eebcfaa9bfa46f9bf270

See more details on using hashes here.

File details

Details for the file fast_arrow-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: fast_arrow-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 163.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for fast_arrow-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8a35a7049ae926d7af339385ce70232568b652f596b3e3bbe25e96720448bc8a
MD5 8cac4bfef1cbcc252009e861b7a6e627
BLAKE2b-256 6b80f6e5fdffc0ce40177023d6e4500831132c32dbd3dbcad2817325e6425b69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page