Skip to main content

eTrade API wrappers

Project description

pyetrade

Python E-Trade API Wrapper PyPI PyPI PyPI Build Status codecov

Completed

v1 API Authorization API - ALL Accounts

  • list accounts

Authorization API - ALL Order API -

  • List Orders
  • Place Equity Order
  • Cancel Order

Market API -

  • Look Up Product
  • optionchain
  • Get Quote

Install

pip install pyetrade
- or -
git clone https://github.com/jessecooper/pyetrade.git
cd pyetrade
sudo make init
sudo make install

Example Usage

To create the OAuth tokens:

import pyetrade

consumer_key = "<CONSUMER_KEY>"
consumer_secret = "<SECRET_KEY>"

oauth = pyetrade.ETradeOAuth(consumer_key, consumer_secret)
print(oauth.get_request_token())  # Use the printed URL

verifier_code = input("Enter verification code: ")
tokens = oauth.get_access_token(verifier_code)
print(tokens)

And then on the example code:

import pyetrade

consumer_key = "<CONSUMER_KEY>"
consumer_secret = "<SECRET_KEY>"
tokens = {'oauth_token': '<TOKEN FROM THE SCRIPT ABOVE>',
          'oauth_token_secret': '<TOKEN FROM THE SCRIPT ABOVE>'}

accounts = pyetrade.ETradeAccounts(
    consumer_key,
    consumer_secret,
    tokens['oauth_token'],
    tokens['oauth_token_secret']
)

print(accounts.list_accounts())

Documentation

PyEtrade Documentation

Contribute to pyetrade

    make init
    make devel

or

    pip install -r requirements.txt
    pip install -r requirements_dev.txt
    pip install -e .
  • Lint
# Run Black
black pyetrade/
# Run Linter
pylint pyetrade/  #Lint score should be >=8
  • Test
make test #Ensure test coverage is >80%
  • Push Changes: Push changes to a branch on your forked repo
  • Create pull request

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

pyetrade-2.0.1.tar.gz (31.8 kB view details)

Uploaded Source

File details

Details for the file pyetrade-2.0.1.tar.gz.

File metadata

  • Download URL: pyetrade-2.0.1.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pyetrade-2.0.1.tar.gz
Algorithm Hash digest
SHA256 19839e3819386f41619cdade1d410fa0b92ab35961725615c3fd81052875e30d
MD5 3b2ee3cc5c07cf13fc6310b5e4188382
BLAKE2b-256 d8806de75f8450e1c49efb152bab4c3377dc46df337cb292c0dc75570635cce3

See more details on using hashes here.

Provenance

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