-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8904d7
commit 351a5d7
Showing
6 changed files
with
204 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version = 1 | ||
|
||
[[analyzers]] | ||
name = "python" | ||
|
||
[analyzers.meta] | ||
runtime_version = "3.x.x" | ||
|
||
[[transformers]] | ||
name = "black" | ||
|
||
[[transformers]] | ||
name = "isort" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Public to PyPI | ||
name: Publish to PyPI | ||
on: | ||
push: | ||
paths: | ||
- "setup.py" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: "pypi" | ||
url: https://pypi.org/p/fennel-invest-api | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build and Publish | ||
uses: lsst-sqre/build-and-publish-to-pypi@v2 | ||
with: | ||
python-version: "3.11" | ||
upload: ${{ github.ref == 'refs/heads/main' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,71 @@ | ||
# fennel-invest-api | ||
# Unofficial Fennel Invest API | ||
|
||
This is an unofficial API for Fennel.com. It is a simple Python wrapper around the Fennel.com GraphQL API. It is not affiliated with Fennel.com in any way. | ||
|
||
Fennel does everything via GraphQL, so yes, this is very slow. | ||
|
||
This is still a work in progress, so it will have bugs and missing features. Please feel free to contribute! | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install fennel-invest-api | ||
``` | ||
|
||
## Usage: Logging In | ||
|
||
```python | ||
from fennel_invest_api import Fennel | ||
|
||
fennel = Fennel() | ||
fennel.login( | ||
email="[email protected]", | ||
wait_for_2fa=True # When logging in for the first time, you need to wait for email 2FA | ||
) | ||
``` | ||
|
||
If you'd like to handle the 2FA yourself programmatically instead of waiting for `input()`, you can call it with `wait_for_2fa=False`, catch the 2FA exception, then call it again with the 2FA code: | ||
|
||
```python | ||
fennel.login( | ||
email="[email protected]", | ||
wait_for_2fa=False | ||
code="123456" # Should be six-digit integer from email | ||
) | ||
``` | ||
|
||
## Usage: Get Stock Holdings | ||
```python | ||
positions = fennel.get_stock_holdings() | ||
for position in positions: | ||
print(position) | ||
``` | ||
|
||
## Usage: Get Portfolio | ||
```python | ||
portfolio = fennel.get_portfolio_summary() | ||
print(portfolio) | ||
``` | ||
|
||
## Usage: Placing Orders | ||
```python | ||
order = fennel.place_order( | ||
symbol="AAPL", | ||
quantity=1, | ||
side="buy", # Must be "buy" or "sell" | ||
price="market" # Only market orders are supported for now | ||
) | ||
print(order) | ||
``` | ||
|
||
## Contributing | ||
Found or fixed a bug? Have a feature request? Feel free to open an issue or pull request! | ||
|
||
Enjoying the project? Feel free to Sponsor me on GitHub or Ko-fi! | ||
|
||
[![Sponsor](https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=#white)](https://github.com/sponsors/NelsonDane) | ||
[![ko-fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white | ||
)](https://ko-fi.com/X8X6LFCI0) | ||
|
||
## DISCLAIMER | ||
DISCLAIMER: I am not a financial advisor and not affiliated with Fennel.com. Use this tool at your own risk. I am not responsible for any losses or damages you may incur by using this project. This tool is provided as-is with no warranty. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from setuptools import setup | ||
|
||
setup( | ||
name="fennel_invest_api", | ||
version="1.0.0", | ||
description="Unofficial Fennel.com Invest API written in Python Requests", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/NelsonDane/fennel-invest-api", | ||
author="Nelson Dane", | ||
packages=["fennel_invest_api"], | ||
install_requires=["requests", "python-dotenv"], | ||
) |