Dart SDK
Free API key for Open-Source projects
First, use the TypeForm to provide all the required information. After registration, you will receive an API key by email, if you are admitted to the program.
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);
Updated 9 months ago