Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Functions, Fixes and Formatting #91

Merged
merged 22 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3002db9
update tests and tox coverage pytest cmd
Robert-Zacchigna Apr 8, 2024
b0c725a
add 'get_portfolio_position_lot' function
Robert-Zacchigna Apr 8, 2024
47de47c
update .pre-commit config and run new config to format files
Robert-Zacchigna Apr 8, 2024
8828978
remove 'jxmlease'
Robert-Zacchigna Apr 8, 2024
fb27652
Revert "remove 'jxmlease'"
Robert-Zacchigna Apr 8, 2024
f95384d
update make devel cmd to install pre-commit hooks
Robert-Zacchigna Apr 8, 2024
59ee7ce
Update README
Robert-Zacchigna Apr 8, 2024
eb417a0
Update README
Robert-Zacchigna Apr 8, 2024
602b3e8
general formatting
Robert-Zacchigna Apr 9, 2024
1f00320
update function descriptions, unit tests and other general formatting
Robert-Zacchigna Apr 9, 2024
d842996
fix list_alerts limit and general formatting
Robert-Zacchigna Apr 9, 2024
613bb9a
fix get_quote symbols limit and other general formatting
Robert-Zacchigna Apr 9, 2024
b5270d5
update/lint list_orders func and add list_order_details func
Robert-Zacchigna Apr 9, 2024
b1b1fe0
Update readme with all completed endpoints/functions and other format…
Robert-Zacchigna Apr 9, 2024
97714f7
formatting
Robert-Zacchigna Apr 9, 2024
9846904
Remove 'pipenv' and replace with 'poetry'
Robert-Zacchigna Apr 18, 2024
1065a8f
update and lock requirements using poetry
Robert-Zacchigna Apr 18, 2024
665c685
fix pre-commit install cmd
Robert-Zacchigna Apr 18, 2024
e910df1
revert pre-commit cmd change and add pre-commit dev dependency
Robert-Zacchigna Apr 18, 2024
725e268
change 'poetry' installation method to use pip and update dev require…
Robert-Zacchigna Apr 18, 2024
07891b6
Make explicit when an optional variable is 'None' when not being used
Robert-Zacchigna Apr 18, 2024
0d0960c
update poetry lock and setup.py supported python versions
Robert-Zacchigna Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading