tastytrade-cli 0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tastytrade_cli-0.4/.github/FUNDING.yml +3 -0
- tastytrade_cli-0.4/.github/workflows/python-app.yml +28 -0
- tastytrade_cli-0.4/.github/workflows/python-publish-test.yml +53 -0
- tastytrade_cli-0.4/.github/workflows/python-publish.yml +51 -0
- tastytrade_cli-0.4/.gitignore +109 -0
- tastytrade_cli-0.4/LICENSE +21 -0
- tastytrade_cli-0.4/MANIFEST.in +1 -0
- tastytrade_cli-0.4/Makefile +10 -0
- tastytrade_cli-0.4/PKG-INFO +121 -0
- tastytrade_cli-0.4/README.md +88 -0
- tastytrade_cli-0.4/pyproject.toml +41 -0
- tastytrade_cli-0.4/ttcli/__init__.py +0 -0
- tastytrade_cli-0.4/ttcli/app.py +32 -0
- tastytrade_cli-0.4/ttcli/data/__init__.py +0 -0
- tastytrade_cli-0.4/ttcli/data/ttcli.cfg +45 -0
- tastytrade_cli-0.4/ttcli/option.py +1070 -0
- tastytrade_cli-0.4/ttcli/portfolio.py +605 -0
- tastytrade_cli-0.4/ttcli/trade.py +315 -0
- tastytrade_cli-0.4/ttcli/utils.py +191 -0
- tastytrade_cli-0.4/uv.lock +1101 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Python application
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
- name: Set up Python 3.12
|
|
15
|
+
uses: actions/setup-python@v4
|
|
16
|
+
with:
|
|
17
|
+
python-version: '3.12'
|
|
18
|
+
- uses: yezz123/setup-uv@v4
|
|
19
|
+
- name: Setup uv venv
|
|
20
|
+
run: |
|
|
21
|
+
uv sync
|
|
22
|
+
uv pip install .
|
|
23
|
+
- name: Lint with ruff
|
|
24
|
+
run: |
|
|
25
|
+
uv run ruff check ttcli/
|
|
26
|
+
- name: Type check with pyright
|
|
27
|
+
run: |
|
|
28
|
+
uv run pyright ttcli/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Publish Python distribution to TestPyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Build distribution
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.x"
|
|
17
|
+
- name: Install pypa/build
|
|
18
|
+
run: >-
|
|
19
|
+
python3 -m
|
|
20
|
+
pip install
|
|
21
|
+
build
|
|
22
|
+
--user
|
|
23
|
+
- name: Build a binary wheel and a source tarball
|
|
24
|
+
run: python3 -m build
|
|
25
|
+
- name: Store the distribution packages
|
|
26
|
+
uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: python-package-distributions
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish-to-testpypi:
|
|
32
|
+
name: Publish Python distribution to TestPyPI
|
|
33
|
+
needs:
|
|
34
|
+
- build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
|
|
37
|
+
environment:
|
|
38
|
+
name: testpypi
|
|
39
|
+
url: https://test.pypi.org/p/tastytrade-cli
|
|
40
|
+
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download all the dists
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: python-package-distributions
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Publish distribution to TestPyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
52
|
+
with:
|
|
53
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish Python distribution to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
name: Build distribution
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.x"
|
|
18
|
+
- name: Install pypa/build
|
|
19
|
+
run: >-
|
|
20
|
+
python3 -m
|
|
21
|
+
pip install
|
|
22
|
+
build
|
|
23
|
+
--user
|
|
24
|
+
- name: Build a binary wheel and a source tarball
|
|
25
|
+
run: python3 -m build
|
|
26
|
+
- name: Store the distribution packages
|
|
27
|
+
uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: python-package-distributions
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
publish-to-pypi:
|
|
33
|
+
name: >-
|
|
34
|
+
Publish Python distribution to PyPI
|
|
35
|
+
needs:
|
|
36
|
+
- build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/p/tastytrade-cli
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download all the dists
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: python-package-distributions
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Publish distribution to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# User-generated items
|
|
2
|
+
*.png
|
|
3
|
+
*.ipynb
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
# Usually these files are written by a python script from a template
|
|
34
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
35
|
+
*.manifest
|
|
36
|
+
*.spec
|
|
37
|
+
|
|
38
|
+
# Installer logs
|
|
39
|
+
pip-log.txt
|
|
40
|
+
pip-delete-this-directory.txt
|
|
41
|
+
|
|
42
|
+
# Unit test / coverage reports
|
|
43
|
+
htmlcov/
|
|
44
|
+
.tox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
coverage-report/
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# pyenv
|
|
81
|
+
.python-version
|
|
82
|
+
|
|
83
|
+
# celery beat schedule file
|
|
84
|
+
celerybeat-schedule
|
|
85
|
+
|
|
86
|
+
# SageMath parsed files
|
|
87
|
+
*.sage.py
|
|
88
|
+
|
|
89
|
+
# Environments
|
|
90
|
+
.env
|
|
91
|
+
.venv
|
|
92
|
+
env/
|
|
93
|
+
venv/
|
|
94
|
+
ENV/
|
|
95
|
+
env.bak/
|
|
96
|
+
venv.bak/
|
|
97
|
+
|
|
98
|
+
# Spyder project settings
|
|
99
|
+
.spyderproject
|
|
100
|
+
.spyproject
|
|
101
|
+
|
|
102
|
+
# Rope project settings
|
|
103
|
+
.ropeproject
|
|
104
|
+
|
|
105
|
+
# mkdocs documentation
|
|
106
|
+
/site
|
|
107
|
+
|
|
108
|
+
# mypy
|
|
109
|
+
.mypy_cache/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Graeme Holliday
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include ttcli/data/*.cfg
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: tastytrade-cli
|
|
3
|
+
Version: 0.4
|
|
4
|
+
Summary: An easy-to-use command line interface for Tastytrade!
|
|
5
|
+
Project-URL: Homepage, https://github.com/tastyware/tastytrade-cli
|
|
6
|
+
Author-email: Graeme Holliday <graeme.holliday@pm.me>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2021 Graeme Holliday
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Requires-Dist: asyncclick>=8.1.7.2
|
|
30
|
+
Requires-Dist: rich>=13.8.1
|
|
31
|
+
Requires-Dist: tastytrade>=9.3
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/tastytrade-cli)
|
|
35
|
+
[](https://pepy.tech/project/tastytrade-cli)
|
|
36
|
+
[](https://github.com/tastyware/tastytrade-cli/releases)
|
|
37
|
+
|
|
38
|
+
# tastytrade-cli
|
|
39
|
+
|
|
40
|
+
An easy-to-use command line interface for Tastytrade!
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
$ pip install tastytrade-cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> [!WARNING]
|
|
51
|
+
> The CLI is still under active development. Please report any bugs, and contributions are always welcome!
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
Available commands:
|
|
56
|
+
```
|
|
57
|
+
tt option view chains, buy or sell equities and futures options
|
|
58
|
+
tt pf (portfolio) view and close positions, check margin and analyze BP usage
|
|
59
|
+
tt trade buy or sell stocks/ETFs, crypto, and futures
|
|
60
|
+
```
|
|
61
|
+
Unavailable commands pending development:
|
|
62
|
+
```
|
|
63
|
+
tt order view, replace, and cancel orders
|
|
64
|
+
tt wl (watchlist) view current prices and other data for symbols in your watchlists
|
|
65
|
+
```
|
|
66
|
+
For more options, run `tt --help` or `tt <subcommand> --help`.
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
Many aspects of the CLI's behavior can be customized using the `ttcli.cfg` file generated upon the first usage of the CLI. The file is located in your OS's home directory followed by the path `.config/ttcli/ttcli.cfg`. If you don't know where that is, you can just run `python -c "from ttcli.utils import config_path; print(config_path)"`.
|
|
71
|
+
|
|
72
|
+
The default configuration file contains lots of options along with explanations of what they do.
|
|
73
|
+
|
|
74
|
+
## Shell completion
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Bash</summary>
|
|
77
|
+
|
|
78
|
+
Add this line to your `.bashrc`:
|
|
79
|
+
```bash
|
|
80
|
+
eval "$(_TT_COMPLETE=bash_source tt)"
|
|
81
|
+
```
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Zsh</summary>
|
|
86
|
+
|
|
87
|
+
Add this line to your `.zshrc`:
|
|
88
|
+
```zsh
|
|
89
|
+
eval "$(_TT_COMPLETE=zsh_source tt)"
|
|
90
|
+
```
|
|
91
|
+
</details>
|
|
92
|
+
|
|
93
|
+
<details>
|
|
94
|
+
<summary>Fish</summary>
|
|
95
|
+
|
|
96
|
+
Add this to `~/.config/fish/completions/tt.fish`
|
|
97
|
+
```fish
|
|
98
|
+
_TT_COMPLETE=fish_source tt | source
|
|
99
|
+
```
|
|
100
|
+
</details>
|
|
101
|
+
|
|
102
|
+
## Development/Contributing
|
|
103
|
+
|
|
104
|
+
This project includes a number of helpers in the `Makefile` to streamline common development tasks.
|
|
105
|
+
Make sure you already have [uv](https://docs.astral.sh/uv/getting-started/installation/) installed!
|
|
106
|
+
|
|
107
|
+
Creating a virtualenv for development:
|
|
108
|
+
```
|
|
109
|
+
$ make install
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
It's usually a good idea to make sure you're passing tests locally before submitting a PR:
|
|
113
|
+
```
|
|
114
|
+
$ make lint
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If you have a feature suggestion, find a bug, or would like to contribute, feel free to open an issue or create a pull request.
|
|
118
|
+
|
|
119
|
+
## Disclaimer
|
|
120
|
+
|
|
121
|
+
tastyworks and tastytrade are not affiliated with the makers of this program and do not endorse this product. This program does not provide investment, tax, or legal advice. Stock trading involves risk and is not suitable for all investors. Options involve risk and are not suitable for all investors as the special risks inherent to options trading may expose investors to potentially significant losses. Futures and futures options trading is speculative and is not suitable for all investors. Cryptocurrency trading is speculative and is not suitable for all investors.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
[](https://pypi.org/project/tastytrade-cli)
|
|
2
|
+
[](https://pepy.tech/project/tastytrade-cli)
|
|
3
|
+
[](https://github.com/tastyware/tastytrade-cli/releases)
|
|
4
|
+
|
|
5
|
+
# tastytrade-cli
|
|
6
|
+
|
|
7
|
+
An easy-to-use command line interface for Tastytrade!
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
$ pip install tastytrade-cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> [!WARNING]
|
|
18
|
+
> The CLI is still under active development. Please report any bugs, and contributions are always welcome!
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Available commands:
|
|
23
|
+
```
|
|
24
|
+
tt option view chains, buy or sell equities and futures options
|
|
25
|
+
tt pf (portfolio) view and close positions, check margin and analyze BP usage
|
|
26
|
+
tt trade buy or sell stocks/ETFs, crypto, and futures
|
|
27
|
+
```
|
|
28
|
+
Unavailable commands pending development:
|
|
29
|
+
```
|
|
30
|
+
tt order view, replace, and cancel orders
|
|
31
|
+
tt wl (watchlist) view current prices and other data for symbols in your watchlists
|
|
32
|
+
```
|
|
33
|
+
For more options, run `tt --help` or `tt <subcommand> --help`.
|
|
34
|
+
|
|
35
|
+
## Configuration
|
|
36
|
+
|
|
37
|
+
Many aspects of the CLI's behavior can be customized using the `ttcli.cfg` file generated upon the first usage of the CLI. The file is located in your OS's home directory followed by the path `.config/ttcli/ttcli.cfg`. If you don't know where that is, you can just run `python -c "from ttcli.utils import config_path; print(config_path)"`.
|
|
38
|
+
|
|
39
|
+
The default configuration file contains lots of options along with explanations of what they do.
|
|
40
|
+
|
|
41
|
+
## Shell completion
|
|
42
|
+
<details>
|
|
43
|
+
<summary>Bash</summary>
|
|
44
|
+
|
|
45
|
+
Add this line to your `.bashrc`:
|
|
46
|
+
```bash
|
|
47
|
+
eval "$(_TT_COMPLETE=bash_source tt)"
|
|
48
|
+
```
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
<details>
|
|
52
|
+
<summary>Zsh</summary>
|
|
53
|
+
|
|
54
|
+
Add this line to your `.zshrc`:
|
|
55
|
+
```zsh
|
|
56
|
+
eval "$(_TT_COMPLETE=zsh_source tt)"
|
|
57
|
+
```
|
|
58
|
+
</details>
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
<summary>Fish</summary>
|
|
62
|
+
|
|
63
|
+
Add this to `~/.config/fish/completions/tt.fish`
|
|
64
|
+
```fish
|
|
65
|
+
_TT_COMPLETE=fish_source tt | source
|
|
66
|
+
```
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
## Development/Contributing
|
|
70
|
+
|
|
71
|
+
This project includes a number of helpers in the `Makefile` to streamline common development tasks.
|
|
72
|
+
Make sure you already have [uv](https://docs.astral.sh/uv/getting-started/installation/) installed!
|
|
73
|
+
|
|
74
|
+
Creating a virtualenv for development:
|
|
75
|
+
```
|
|
76
|
+
$ make install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
It's usually a good idea to make sure you're passing tests locally before submitting a PR:
|
|
80
|
+
```
|
|
81
|
+
$ make lint
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If you have a feature suggestion, find a bug, or would like to contribute, feel free to open an issue or create a pull request.
|
|
85
|
+
|
|
86
|
+
## Disclaimer
|
|
87
|
+
|
|
88
|
+
tastyworks and tastytrade are not affiliated with the makers of this program and do not endorse this product. This program does not provide investment, tax, or legal advice. Stock trading involves risk and is not suitable for all investors. Options involve risk and are not suitable for all investors as the special risks inherent to options trading may expose investors to potentially significant losses. Futures and futures options trading is speculative and is not suitable for all investors. Cryptocurrency trading is speculative and is not suitable for all investors.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tastytrade-cli"
|
|
7
|
+
version = "0.4"
|
|
8
|
+
description = "An easy-to-use command line interface for Tastytrade!"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {file = "LICENSE"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Graeme Holliday", email = "graeme.holliday@pm.me"},
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
"asyncclick>=8.1.7.2",
|
|
18
|
+
"rich>=13.8.1",
|
|
19
|
+
"tastytrade>=9.3",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/tastyware/tastytrade-cli"
|
|
24
|
+
|
|
25
|
+
[tool.uv]
|
|
26
|
+
dev-dependencies = [
|
|
27
|
+
"ipykernel>=6.29.5",
|
|
28
|
+
"pyright>=1.1.389",
|
|
29
|
+
"ruff>=0.6.7",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.ruff.lint]
|
|
33
|
+
ignore = [
|
|
34
|
+
"E731", # lambda-assignment
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
tt = "ttcli.app:main"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["ttcli"]
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
from importlib.resources import as_file, files
|
|
4
|
+
|
|
5
|
+
import asyncclick as click
|
|
6
|
+
|
|
7
|
+
from ttcli.option import option
|
|
8
|
+
from ttcli.portfolio import portfolio
|
|
9
|
+
from ttcli.trade import trade
|
|
10
|
+
from ttcli.utils import CONTEXT_SETTINGS, VERSION, config_path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@click.group(context_settings=CONTEXT_SETTINGS)
|
|
14
|
+
@click.version_option(VERSION)
|
|
15
|
+
async def app():
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main():
|
|
20
|
+
app.add_command(option)
|
|
21
|
+
app.add_command(portfolio, name="pf")
|
|
22
|
+
app.add_command(trade)
|
|
23
|
+
|
|
24
|
+
# create ttcli.cfg if it doesn't exist
|
|
25
|
+
if not os.path.exists(config_path):
|
|
26
|
+
data_file = files("ttcli.data").joinpath("ttcli.cfg")
|
|
27
|
+
with as_file(data_file) as path:
|
|
28
|
+
# copy default config to user home dir
|
|
29
|
+
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
|
30
|
+
shutil.copyfile(path, config_path)
|
|
31
|
+
|
|
32
|
+
app(_anyio_backend="asyncio")
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[general]
|
|
2
|
+
# the username & password can be passed to the CLI in 3 ways: here,
|
|
3
|
+
# through the $TT_USERNAME/$TT_PASSWORD environment variables, or,
|
|
4
|
+
# if neither is present, entered manually.
|
|
5
|
+
# username = foo
|
|
6
|
+
# password = bar
|
|
7
|
+
|
|
8
|
+
# the account number to use by default for trades/portfolio commands.
|
|
9
|
+
# this bypasses the account choice menu.
|
|
10
|
+
# default-account = 5WX01234
|
|
11
|
+
|
|
12
|
+
[portfolio]
|
|
13
|
+
# this number controls how much BP can be used in total, relative to
|
|
14
|
+
# the current $VIX level, before the CLI will warn you.
|
|
15
|
+
# for example, with a VIX of 25, BP usage of 40%, and variation of 10,
|
|
16
|
+
# you'd be warned for high BP usage since the acceptable range would be
|
|
17
|
+
# VIX - variation < BP% < VIX + variation. you may also be warned for
|
|
18
|
+
# low usage if you're perceived to be using your capital inefficiently;
|
|
19
|
+
# e.g. with a VIX of 25, BP usage of 10%, and variation of 10.
|
|
20
|
+
bp-target-percent-variation = 10
|
|
21
|
+
# this sets an upper bound for the amount of BP that can be allocated
|
|
22
|
+
# to a single positions before the CLI will warn you.
|
|
23
|
+
bp-max-percent-per-position = 5.0
|
|
24
|
+
# this allows you to set a target beta-weighted delta for your portfolio;
|
|
25
|
+
# the CLI will warn you unless target - variation < BWD < target + variation.
|
|
26
|
+
delta-target = 0
|
|
27
|
+
delta-variation = 5
|
|
28
|
+
[portfolio.positions]
|
|
29
|
+
# these control whether the columns show up when running `tt pf positions`
|
|
30
|
+
show-mark-price = true
|
|
31
|
+
show-trade-price = false
|
|
32
|
+
show-delta = false
|
|
33
|
+
show-theta = false
|
|
34
|
+
show-gamma = false
|
|
35
|
+
|
|
36
|
+
[option]
|
|
37
|
+
# the default days to expiration to use for option-related commands;
|
|
38
|
+
# this bypasses the date selection menu.
|
|
39
|
+
# default-dte = 45
|
|
40
|
+
[option.chain]
|
|
41
|
+
# these control whether the columns show up when running `tt option chain`
|
|
42
|
+
show-delta = true
|
|
43
|
+
show-volume = false
|
|
44
|
+
show-open-interest = true
|
|
45
|
+
show-theta = false
|