diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 0000000..63de745 --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,76 @@ +name: Publish to PyPI +on: + push: + pull_request: + branches: + - main +jobs: + build: + name: Build Distribution + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + python -m pip install -r requirements.txt + - name: Build distribution in binary and source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + pypi-publish: + name: Publish release to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/CSchwabPy + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + # retrieve your distributions here + - name: Download distribution packages + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + # - name: Sign the dists with Sigstore + # uses: sigstore/gh-action-sigstore-python@v2.1.1 + # with: + # inputs: >- + # ./dist/*.tar.gz + # ./dist/*.whl + # - name: Create GitHub Release + # env: + # GITHUB_TOKEN: ${{ github.token }} + # run: >- + # gh release create + # '${{ github.ref_name }}' + # --repo '${{ github.repository }}' + # --notes "" + # - name: Upload artifact signatures to GitHub Release + # env: + # GITHUB_TOKEN: ${{ github.token }} + # # Upload to GitHub Release using the `gh` CLI. + # # `dist/` contains the built packages, and the + # # sigstore-produced signatures and certificates. + # run: >- + # gh release upload + # '${{ github.ref_name }}' dist/** + # --repo '${{ github.repository }}' diff --git a/cschwabpy/SchwabAsyncClient.py b/cschwabpy/SchwabAsyncClient.py index cb941e2..c77e063 100644 --- a/cschwabpy/SchwabAsyncClient.py +++ b/cschwabpy/SchwabAsyncClient.py @@ -10,7 +10,6 @@ import time import httpx import re -import os import base64 diff --git a/cschwabpy/models/__init__.py b/cschwabpy/models/__init__.py index ec5a72c..cfb6bce 100644 --- a/cschwabpy/models/__init__.py +++ b/cschwabpy/models/__init__.py @@ -79,7 +79,7 @@ class OptionChainQueryFilter(QueryFilterBase): symbol: str contractType: OptionContractType = OptionContractType.ALL strikeCount: int = ( - 25 # the number of strikes to return above or below the at-the-money price + 40 # the number of strikes to return above or below the at-the-money price ) includeUnderlyingQuote: bool = True strategy: OptionContractStrategy = OptionContractStrategy.ANALYTICAL diff --git a/pyproject.toml b/pyproject.toml index 3a1c827..6a53671 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "" authors = ["Tony Wang "] readme = "README.md" -packages = [{include = "cschwab"}] +packages = [{include = "cschwabpy"}] [tool.poetry.dependencies] python = "^3.10.13" diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..d8fe80b --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +minversion = 7.0 +pythonpath = schwabpy +testpaths = + tests diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0ea84d1 --- /dev/null +++ b/setup.py @@ -0,0 +1,16 @@ +from setuptools import setup + +with open("README.md") as file: + long_description = file.read() + +setup( + name="CSchwabPy", + version="0.1.0", + description="Charles Schwab Stock & Option Trade API Client for Python.", + long_description=long_description, + long_description_content_type="text/markdown", + author="Tony W", + author_email="ivytony@gmail.com", + url="https://pypi.org/project/CSchwabPy/", + keywords=["python", "CSchwabPy", "Charles Schwab", "Stock", "Option", "Trade"], +)