Python client library for Cowrywise Embed Investments API
Project description
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.
# Set environment variables
CLIENT_ID = CWRY-substitute-yours-here
CLIENT_SECRET = CWRY-SECRET-substitute-yours-here
# Create an instance of the Embed Client
from embed.client import Client
client = Client()
Alternatively, you can use your credentials to instantiate the Embed Client. During this instantiation, you can specify a base URL. This is an optional parameter that defaults to the sandbox base URL.
from embed.client import Client
client = Client(client_id='****', client_secret='****', base_url="https://***.cowrywise.com")
Embed API REST Methods
| Rest Method | Endpoint |
|---|---|
| create_account(first_name=None, last_name=None, email=None) | POST /accounts |
| get_account(account_id) | GET /accounts/:id |
| update_next_of_kin(account_id=None, email=None, first_name=None,/last_name=None, phone_number=None, relationship=None, gender=None) | 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) | POST /investments |
| liquidate_investment(investment_id=None, units=None) | POST /investments/:id |
| 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 |
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedpy-2.1.0.tar.gz.
File metadata
- Download URL: embedpy-2.1.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf09589f90ed3d2b44e576bc99b7feba8b3a150d833f72c6e12fefd921a3a27
|
|
| MD5 |
7707ca03b08f808a6609518c7aba46d8
|
|
| BLAKE2b-256 |
587b57aa4bce50bdfdfda58ab113a827d8c741ed87d6f1cd5dc005af1360fa75
|
File details
Details for the file embedpy-2.1.0-py3-none-any.whl.
File metadata
- Download URL: embedpy-2.1.0-py3-none-any.whl
- Upload date:
- Size: 30.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
057589692adf8c0892c92c9eafafcbe207bd5213ecde74c647154965e2c3a93d
|
|
| MD5 |
da1fc0ec3a3f8d1f6456feb3ec465528
|
|
| BLAKE2b-256 |
7723d6b798749726e76ef3d863cd0ba0a6d812cafb2ef6cf9abfee091c6b447a
|