The Bavest Finance Python SDK
Project description
Bavest Python SDK
The Bavest Finance SDK is an open-source library to create finance products in weeks. Bavest offers:
- Financial api with 99.95% uptime
- Easy to integrate and use
- Free for open-source projects
Get API key
First, you need to create a Bavest account. After registration, you will find your api key in the dashboard.
Free API key for Open-Source projects
First, use the TypeForm to provide all required information. After, you will receive an API key via E-Mail.
Template
import os
import dateutil
from bavest import BavestRESTClient, Resolution
from datetime import datetime
import dateutil.relativedelta as relativedelta
BAVEST_API_KEY = os.environ.get('BAVEST_API_KEY')
client = BavestRESTClient(BAVEST_API_KEY)
if __name__ == "__main__":
to = datetime.now()
frm = to + dateutil.relativedelta.relativedelta(days=-2)
to = to + dateutil.relativedelta.relativedelta(days=-1)
resolution = Resolution.DAILY
candles = client.candles("AAPL", frm, to, resolution)
Install the package
First install the python package using pip:
pip install bavest
Documentation
See here for more information.
Usage
- Now, use the package in your project:
from bavest import BavestRESTClient
- Create a finance
client
:
client = BavestRestClient(apiKey)
- Now you can use it to get data from the api:
quote = client.quote("AAPL")
Examples
to = datetime.now()
frm = to + dateutil.relativedelta.relativedelta(days=-20)
resolution = Resolution.MONTHLY
candles = client.candles(symbol, frm, to, resolution)
news = client.news(symbol)
search = client.search(symbol)
forex = client.forex(frm, to)
# ETF
etfSector = client.etf.sector(symbol)
etfCountry = client.etf.country(symbol)
etfHoldings = client.etf.holdings(symbol)
etfProfile = client.etf.profile(symbol)
# Portfolio Items
transactionItem = TransactionItem("MSFT", 2, frm).get()
transactionList = [transactionItem]
portfolioRegion = client.portfolio.region(transactionList)
portfolioStats = client.portfolio.stats(frm, to, resolution, transactionList, "USD")
portfolioChart = client.portfolio.chart(frm, to, resolution, transactionList)
:octocat: Credits
- William Todt william.todt@bavest.co - Maintainer
- Hisham Parveez hisham.parveez@bavest.co - Maintainer
Contact
Please open a Github issue or send us an email at support@bavest.co
.
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
bavest-1.0.1.tar.gz
(16.5 kB
view hashes)
Built Distribution
bavest-1.0.1-py3-none-any.whl
(36.5 kB
view hashes)