Skip to content

Commit

Permalink
Merge pull request #91 from Robert-Zacchigna/master
Browse files Browse the repository at this point in the history
New Functions, Fixes and Formatting
  • Loading branch information
jessecooper authored Apr 19, 2024
2 parents ba0a326 + 0d0960c commit 15eff5f
Show file tree
Hide file tree
Showing 24 changed files with 3,722 additions and 974 deletions.
1 change: 0 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ tag = True
[bumpversion:file:setup.py]

[bumpversion:file:pyetrade/__init__.py]

2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

57 changes: 39 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
defualt_stages: [commit, push]
fail_fast: true
default_stages: [commit, push]
fail_fast: false
repos:
- repo: https://github.com/ambv/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/szebenyib/pre-commit-pytest
rev: 051fea31dbabf063ab38428c34a92c76d1abd5dc
hooks:
- id: pytest
- repo: https://github.com/python-poetry/poetry
rev: 1.8.2
hooks:
- id: poetry-check
- id: poetry-lock
- id: poetry-export
args: ["-f", "requirements.txt", "-o", "requirements.txt", "--without-hashes"]
- id: poetry-export # Dev dependencies
args: ["-f", "requirements.txt", "-o", "requirements_dev.txt", "--with", "dev", "--without-hashes"]
- id: poetry-install
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/ambv/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
exclude: docs/conf.py
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: end-of-file-fixer
- id: mixed-line-ending
args: ['--fix=no']
- id: trailing-whitespace
- repo: https://github.com/szebenyib/pre-commit-pytest
rev: 051fea31dbabf063ab38428c34a92c76d1abd5dc
hooks:
- id: pytest
42 changes: 21 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ init:
pip install -r requirements.txt
devel:
pip install -r requirements_dev.txt
pre-commit install
pre-commit install --hook-type pre-push --install-hooks -t post-checkout -t post-merge
test:
tox
lint:
flake8 pyetrade tests
analysis: # Lint, format, import optimizer, etc.
poetry run pre-commit run --all-files
install:
pip install --upgrade .
dist:
Expand Down
125 changes: 85 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,71 @@
# pyetrade
# pyetrade (Python E-Trade API Wrapper)

Python E-Trade API Wrapper
[![PyPI](https://img.shields.io/pypi/v/pyetrade.svg)](https://pypi.python.org/pypi/pyetrade)
[![PyPI](https://img.shields.io/pypi/l/pyetrade.svg)]()
[![PyPI](https://img.shields.io/pypi/pyversions/pyetrade.svg)](https://pypi.python.org/pypi/pyetrade)
[![Build Status](https://github.com/jessecooper/pyetrade/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/jessecooper/pyetrade/actions/workflows/build.yml/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/jessecooper/pyetrade/branch/master/graph/badge.svg)](https://codecov.io/gh/jessecooper/pyetrade)

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

* Authorization API (OAuth)
* get_request_token
* get_access_token
* renew_access_token
* revoke_access_token


* Alerts API
* list_alerts
* list_alert_details
* delete_alert


* Accounts API
* list_accounts
* get_account_balance
* get_account_portfolio
* get_portfolio_position_lot
* list_transactions
* list_transaction_details


* Order API
* list_orders
* list_order_details
* find_option_orders
* preview_equity_order
* change_preview_equity_order
* place_equity_order
* place_changed_equity_order
* place_option_order
* place_changed_option_order
* cancel_order


* Market API
* look_up_product
* get_quote
* get_option_chains
* get_option_expire_date

## Install
```

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

## Example Usage

To create the OAuth tokens:

```python
import pyetrade

Expand All @@ -47,6 +77,7 @@ print(oauth.get_request_token()) # Use the printed URL

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

print(tokens)
```

Expand All @@ -69,33 +100,47 @@ accounts = pyetrade.ETradeAccounts(

print(accounts.list_accounts())
```

## Documentation

[PyEtrade Documentation](https://pyetrade.readthedocs.io/en/latest/)

## Contribute to pyetrade
* [ETrade API Docs](https://apisb.etrade.com/docs/api/account/api-account-v1.html)

[ETrade API Docs](https://apisb.etrade.com/docs/api/account/api-account-v1.html)

### Development Setup:

* Fork pyetrade
* Development Setup:
```
make init
make devel
```
or
```
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -e .
```
* Lint
* Setup development environment

```bash
make init
make devel
```
# Run Black
black pyetrade/
# Run Linter
pylint pyetrade/ #Lint score should be >=8
OR
```bash
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install -e .
pre-commit install --hook-type pre-commit --hook-type pre-push --install-hooks -t post-checkout -t post-merge
```
* Test

* Lint (Run analysis - pre-commit-config)

```bash
make analysis
```
make test #Ensure test coverage is >80%

* Test (Coverage >= 90%)

```bash
make test
```
* Push Changes:
Push changes to a branch on your forked repo

* Push Changes
* Push changes to a branch on your forked repo


* Create pull request
* Open a pull request on pyetrade and put your fork as the source of your changes
Loading

0 comments on commit 15eff5f

Please sign in to comment.