Unofficial Fennel.com Invest API written in Python Requests
Project description
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!
Important!
Do not use any version of this library before 1.0.9. Earlier versions had a bug with placing certain orders that when executed excessively could lead to your account being locked. This has been fixed in 1.0.9. See this issue
Installation
pip install 'fennel-invest-api>=1.1.0'
Usage: Logging In
from fennel_invest_api import Fennel
fennel = Fennel()
fennel.login(
email="your-email@email.com",
wait_for_code=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_code=False
, catch the 2FA exception, then call it again with the 2FA code:
fennel.login(
email="your-email@email.com",
wait_for_code=False
code="123456" # Should be six-digit integer from email
)
Usage: Get Stock Holdings
account_ids = fennel.get_account_ids()
for account_id in account_ids:
print(account_id)
positions = fennel.get_stock_holdings(account_id)
for position in positions:
print(position)
Usage: Get Portfolio
# For all account IDs
portfolio = fennel.get_account_ids()
for account_id in account_ids:
print(account_id)
portfolio = fennel.get_portfolio_summary(account_id)
print(portfolio)
# For a single account ID
portfolio = fennel.get_portfolio_summary(account_id)
print(portfolio)
Usage: Placing Orders
order = fennel.place_order(
account_id=account_id,
ticker="AAPL",
quantity=1,
side="buy", # Must be "buy" or "sell"
price="market" # Only market orders are supported for now
dry_run=False # If True, will not actually place the order
)
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!
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fennel_invest_api-1.1.2.tar.gz
.
File metadata
- Download URL: fennel_invest_api-1.1.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83ff149169a4dfd274a703f0d06554d9debf2422264c3b5e4be5464269f4a79a |
|
MD5 | d6835e53ee725bc1f4a9be49591fd27a |
|
BLAKE2b-256 | 5876d5129c912b55eeff3a8c717f37dc040b9fd659d1b801728a790cd4727732 |
Provenance
The following attestation bundles were made for fennel_invest_api-1.1.2.tar.gz
:
Publisher:
pypi_publish.yml
on NelsonDane/fennel-invest-api
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fennel_invest_api-1.1.2.tar.gz
- Subject digest:
83ff149169a4dfd274a703f0d06554d9debf2422264c3b5e4be5464269f4a79a
- Sigstore transparency entry: 148692027
- Sigstore integration time:
- Predicate type:
File details
Details for the file fennel_invest_api-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: fennel_invest_api-1.1.2-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 094852342aedc8525d1da6651a66e55e9470de7cf9be3bec11bd004ac9c0f62d |
|
MD5 | 73c48861ce3b386140ccdfc81639fd3a |
|
BLAKE2b-256 | e84adc8624c65e6e40b79c5b67369c23805f42607d040c64f4ab5bdda71ea63f |
Provenance
The following attestation bundles were made for fennel_invest_api-1.1.2-py3-none-any.whl
:
Publisher:
pypi_publish.yml
on NelsonDane/fennel-invest-api
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
fennel_invest_api-1.1.2-py3-none-any.whl
- Subject digest:
094852342aedc8525d1da6651a66e55e9470de7cf9be3bec11bd004ac9c0f62d
- Sigstore transparency entry: 148692028
- Sigstore integration time:
- Predicate type: