Skip to main content

Embed Python Library

The Embed Python library provides an easy access to the Embed Investment API by Cowrywise. Embed is an investment-as-a-service API that allows you to integrate investment features in your products and offer financial services to your customers at scale. With Embed, developers can create investment accounts for their customers and expose them to a wide variety of investment products!

Documentation

See the Embed API docs.

Installation

Install the package directly via git

pip install git+https://github.com/cowrywise/embedpy.git

You could also install the library via pypi using the pip package manager.

$ pip install -U embedpy

Requirements

  • Python3+

Usage

To get started, sign up for your developer credentials on the Embed Dashboard. Once you have signed up, you can retrieve your client_id and client_secret keys from the developer dashboard. Set your credentials in the environment variables before creating an instance of the Embed Client.

Initialization

from embed.client import Client

# Initialize with environment variables (CLIENT_ID, CLIENT_SECRET)
client = Client()

# Or initialize with explicit credentials
client = Client(
    client_id='your_client_id',
    client_secret='your_client_secret',
    base_url="https://sandbox.cowrywise.com"  # Optional
)

Example: Creating an Account and Investment

# 1. Create a user account
account = client.account.create_account(
    first_name="John",
    last_name="Doe",
    email="john.doe@example.com",
    terms_of_use_accepted=True
)
account_id = account['data']['account_id']

# 2. List available assets
assets = client.asset.list_assets(asset_type="tbills")

# 3. Create an investment
investment = client.investment.create_investment(
    account_id=account_id,
    asset_code="AST-TBILL-0001",
    amount=10000.0
)

Embed API REST Methods

Rest Method Endpoint
create_account(first_name=None, last_name=None, email=None, **kwargs) POST /accounts
get_account(account_id) GET /accounts/:id
update_next_of_kin(account_id, email, first_name, last_name, phone_number, relationship, gender) POST /accounts/:id/nok
get_portfolio(account_id) GET /accounts/:id/portfolio
get_asset(asset_id) GET /assets/:id/
list_assets(country=None, asset_type=None) GET /assets?country=None&asset_type=None
get_index(index_id) GET /indexes/:id
create_custom_index(account_id=None, name=None, description=None, allocations=None) POST /indexes
modify_custom_index(account_id=None, index_id=None, allocations=None) PUT /indexes/:index_id
get_investment(investment_id) GET /investments/:id
create_investment(account_id=None, asset_code=None, **kwargs) POST /investments
liquidate_investment(investment_id=None, units=None, **kwargs) POST /investments/:id/liquidate
get_price_history(asset_id=None, from_date=None, to_date=None) GET /prices?asset_id=None&from_date=None&to_date=None
create_savings(account_id=None, days=None, interest_enabled=None, currency_code=None) POST /savings
buy_stock(account_id=None, symbol=None, amount=None, side=None, the_type=None, time_in_force=None) POST /stocks/buy
sell_stock(account_id=None, symbol=None, amount=None, side=None, the_type=None, time_in_force=None) POST /stocks/sell
list_transfers(account_id=None, email=None, from_date=None, to_date=None) GET /transfers/:id?email=None&from_date=None&to_date=None
get_deposit(deposit_id) GET /deposits/:id
create_wallet(account_id=None, currency_code=None) POST /wallets
transfer(wallet_id=None, product_code=None, amount=None) POST /wallets/:wallet_id/transfer
get_wallet(wallet_id) GET /wallets/:wallet_id
list_flexible_savings(**kwargs) GET /flexible-savings
create_fixed_note(**kwargs) POST /fixed-notes
list_withdrawals(**kwargs) GET /withdrawals

Check the API reference document for all resources and their respective endpoints.

Contributions

We welcome contributions from everyone. Before submitting a pull request, kindly ensure:

  • Necessary tests for the code changes requested are added
  • Code is formatted according to PEP8
  • There is clear commit messages

Release files for embedpy 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for embedpy 2.2.0
File Size Uploaded
embedpy-2.2.0.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for embedpy 2.2.0
File Interpreter ABI Platform
embedpy-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 65.9 kB

Release files / embedpy-2.2.0.tar.gz

Download URL embedpy-2.2.0.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b35f5f5f281b7a49e70b98e2c0419dc05e12c267eb2fc3d624c6e3b67fe85ed3
BLAKE2b-256 checksum
How to use checksums
726afbfa6e4de999320a69fcf4e08e8a851fc5e86a2333c9fe6b7bd1b164ea47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / embedpy-2.2.0-py3-none-any.whl

Download URL embedpy-2.2.0-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27e48dcf33518c4bcc9a9049dd55a898997fcbc6b11b83be4c9e93d4e8ba02b1
BLAKE2b-256 checksum
How to use checksums
6c81f216fb5bd44a916c737478263c997d152402a31c2a46a51778728d806e30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page