Skip to main content

Unofficial Robinhood API client library for Python

Project description

robinhood

GitHub publish PyPI

Unofficial Robinhood API client library for Python

Installation

pipenv install jc.robinhood

Usage

import json
import robinhood as rh

CONFIG_FILENAME = 'config.json'

with open(CONFIG_FILENAME) as f:
    config = json.load(f)

device_token = config['robinhood']['device_token']
username = config['robinhood']['username']
password = config['robinhood']['password']

if device_token == '':
    device_token = rh.generate_device_token()

    print()
    robinhood = rh.Robinhood(device_token, username, password)

    config['robinhood']['device_token'] = device_token

    with open(CONFIG_FILENAME, 'w') as f:
        json.dump(config, f, indent='\t')
        f.write('\n')
else:
    robinhood = rh.Robinhood(device_token, username, password)

print()
print('Positions:')
print()

for position in robinhood.get_positions():
    print(f"{position['symbol']} ({position['quantity']})")

print()

Contributing

You will need Pipenv. On Mac, you can install Pipenv using Homebrew. To install Homebrew, run

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then, to install Pipenv, run

brew install pipenv

To install dependencies, move into the project folder and run

pipenv install

To run tests, fill out the config.json file with your Robinhood username and password and then run

pipenv run test

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

jc.robinhood-2.0.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

jc.robinhood-2.0.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

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