Skip to main content

Unofficial Fennel.com Invest API written in Python Requests

Project description

Unofficial Fennel Invest API

This is an unofficial API for Fennel.com (now) built using the official Fennel API. This project is not affiliated with Fennel.com in any way.

While I try my best to ensure the API is working correctly, it is an ongoing work in progress, so it may have bugs and missing features. Please feel free to contribute!

Important!

Versions prior to 2.0.0 used an unofficial reverse-engineered API that mimicked the Fennel Invest mobile app. With the release of the official API, this library has been updated to use that instead and previous versions are no longer supported or recommended.

Installation

Install with uv:

uv add 'fennel-invest-api>=2.0.0'

Or with pip:

pip install 'fennel-invest-api>=2.0.0'

Usage: Logging In

Generate a new Personal Access Token (PAT) from the Fennel Dashboard.

Then, initialize the Fennel class with your PAT:

from fennel_invest_api import Fennel

fennel = Fennel(pat_token="your-personal-access-token")

Usage: Get Account Info

account_info = fennel.get_account_info()
for account in account_info:
    print(f"Name: {account.name}, Account ID: {account.id}, Type: {account.account_type}")

Usage: Get Account Summary

account_info = fennel.get_account_info()
for account in account_info:
    summary = fennel.get_portfolio_cash_summary(account.id)
    print(f"Account: {account.name}, Portfolio Value: ${summary.portfolio_value:.2f}, Buying Power: ${summary.buying_power:.2f}, Cash: ${summary.cash_available:.2f}")

Usage: Get Stock Holdings

account_info = fennel.get_account_info()
for account_id in account_info:
    positions = fennel.get_portfolio_positions(account_id.id)
    print(f"Positions for account {account_id.name}:")
    for position in positions:
        print(f"{position.symbol}: {position.shares} shares at ${position.value:.2f}")

Usage: Placing Orders

Market order (Default):

order = fennel.place_order(
    account_id=account_id,
    symbol="AAPL",
    shares=1,
    side="BUY"
)
print(order)

Limit order:

order = fennel.place_order(
    account_id=account_id,
    ticker="AAPL",
    quantity=1,
    side="BUY",
    order_type="LIMIT",
    limit_price=150.00,
)
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 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fennel_invest_api-2.0.1.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fennel_invest_api-2.0.1-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file fennel_invest_api-2.0.1.tar.gz.

File metadata

  • Download URL: fennel_invest_api-2.0.1.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fennel_invest_api-2.0.1.tar.gz
Algorithm Hash digest
SHA256 f012b4fcbf817b32b6bcf19ffc747d67aa700fd210393a80a0a69b4b007775a5
MD5 c408ef7fd929806f1b96d314dfcf30c0
BLAKE2b-256 cf99691d4a7e8b454f16d48007334f5a6b334c22c77c3f54750913e3c7c4ebd3

See more details on using hashes here.

File details

Details for the file fennel_invest_api-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: fennel_invest_api-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fennel_invest_api-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b73e0e4960df8af1312766652ded0ad1009ce4a01fd51e8cbbcb11b3a14b185
MD5 ff46337ad02d75978b3bf6fd97d9fa8b
BLAKE2b-256 21c9efd0b0c94dadbb7b5a73428fc84eaab3076fc05f940cc883ba46cd1f9165

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page