Bavest Dart 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.
Install the package
First install the flutter package, it is available at pub.dev:
flutter pub add bavest
Usage
- Now, use the package in your project:
import 'package:bavest/bavest.dart';
- Create a finance
client
:
var client = BavestRestClient(apiKey);
- Now you can use it to get data from the api:
var client = BavestRestClient(apiKey);
final id = SecurityIdentifier(symbol: "AAPL");
var quote = await client.quote(id);
Examples
var profile = await client.profile(id);
var metric = await client.metric(id);
var dividend = await client.dividends(id);
var companyNews = await client.companyNews(id);
var fundamentals = await client.fundamentals(id);
var peersWidget = await client.peersWidget(id);
var forex = await client.forex("EUR", "USD");
var sentiment = await client.sentiment(id);
var splits = await client.splits(id, years: 5);
// ETF
final id = SecurityIdentifier(symbol: "ARKK");
var etfSector = await client.etfSector(id);
var etfCountry = await client.etfCountry(id);
var etfHoldings = await client.etfHoldings(id);
var etfProfile = await client.etfProfile(id);
// Portfolio methods
var portfolio = Portfolio.fromJson({
"portfolio_items": [
{"symbol": "ABEA.DE", "amount": 5, "buy_date": 1649887200000},
{"symbol": "DEQ.DE", "amount": 41, "buy_date": 1619647200000},
{"symbol": "AAPL", "amount": 100, "buy_date": 1556661600000},
{"symbol": "ADS.DE", "amount": 10, "buy_date": 1491343200000}
]
});
var from = 1630352898;
var to = 1655848800;
var resolution = CandleType.day;
await client.portfolioStats(portfolio,
from: from, to: to, resolution: resolution);
var allocation = Portfolio.fromJson({
"portfolio_items": [
{
"symbol": "BNTX",
"amount": 10
},
{
"symbol": "AAPL",
"amount": 4
},
{
"symbol": "SAP.DE",
"amount": 4
}
]
});
await client.portfolioPrice(portfolio);
await client.portfolioAllocation(allocation);
await client.portfolioRegion(allocation);
await client.portfolioSector(allocation);
await client.portfolioPrice(portfolio);
await client.portfolioChart(portfolio,
from: from, to: to, resolution: resolution);
Libraries
- bavest
- The Bavest Finance SDK The SDK is a wrapper around the Bavest Finance API.
- client/abstract/bavest_rest_abstract_client
- client/bavest_rest_client
- client/cache/bavest_cache_manager
- client/event/bavest_websocket_event
- extensions/bavest_function_extension
- model/v0/etf/country/etf_country
- model/v0/etf/holdings/etf_holdings
- model/v0/etf/profile/etf_profile
- model/v0/etf/sector/etf_sector
- model/v0/forex/forex
- model/v0/portfolio/allocation/portfolio_allocation
- model/v0/portfolio/metric/portfolio_metric
- model/v0/portfolio/portfolio
- model/v0/portfolio/region/portfolio_region
- model/v0/portfolio/sector/portfolio_sector
- model/v0/portfolio/stats/portfolio_stats
- model/v0/portfolio/stats/risk_model
- model/v0/portfolio/trade_direction
- model/v0/search/search
- model/v0/security/security_identifier
- model/v0/security/security_type
- model/v0/sentiment/sentiment
- model/v0/stock/candle/candle
- model/v0/stock/candle/candle_type
- model/v0/stock/dividend/dividend
- model/v0/stock/esg/esg
- model/v0/stock/financials/balance
- model/v0/stock/financials/cashflow
- model/v0/stock/financials/financials
- model/v0/stock/financials/financials_mode
- model/v0/stock/financials/income
- model/v0/stock/fundamentals/fundamentals
- model/v0/stock/ipo/ipo
- model/v0/stock/metric/metric
- model/v0/stock/news/news
- model/v0/stock/profile/profile
- model/v0/stock/quote/quote
- model/v0/stock/split/split
- model/v0/widget/peers/peers