一个跨平台的 Flutter 包,提供对股票、商品和加密货币的实时和历史金融数据的访问。它使开发者能够从亚马逊、谷歌、黄金、石油、比特币和以太坊等各种资产中获取报价信息和当前价格。专为集成到金融相关应用而设计,支持跨平台使用,具有简单的 API。该包非常适合构建投资跟踪器、投资组合仪表板或交易工具。它依赖外部 API 获取数据,并需要正确配置认证和速率限制。
适合场景
股票价格跟踪
加密货币市场监控
商品价格更新
投资组合价值计算
财务仪表板开发
主要特点
支持股票、加密货币和大宗商品
实时和历史数据
跨平台兼容性
简单 API 接口
可扩展的数据检索
适合对象
金融应用开发者
投资跟踪工具
交易平台集成
教育金融应用
个人预算应用
使用建议
需要 API 密钥设置
依赖第三方数据提供商
可能应用速率限制
数据准确性取决于数据源
需要网络连接
原始 README
以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。
A Dart plugin for retrieving financial quote prices.
This package provides a set of high-level functions and classes that make it easy to retrieve financial quote information and prices for stocks (Amazon, Google, ...), commodities (Gold, Oil, ...) and crypto-currencies (Bitcoin, Ethereum, ...). It's platform-independent, supports iOS and Android.
Using
The easiest way to use this library is via the top-level functions. They allow you to make quote price requests with minimal hassle:
finalMap<String, Map<String, String>> quotePrice =
awaitFinanceQuote.getPrice(
quoteProvider: QuoteProvider.yahoo, symbols: <String>['KO']);
print('Number of quotes retrieved: ${quotePrice.keys.length}.');
print('Number of attributes retrieved for KO: ${quotePrice['KO'].keys.length}.');
print('Current market price for KO: ${quotePrice['KO']['price']}.');
If you're making multiple quote requests to the same server, you can request all of them in a single function call:
finalMap<String, Map<String, String>> quotePrice =
awaitFinanceQuote.getPrice(
quoteProvider: QuoteProvider.yahoo, symbols: <String>['KO', 'GOOG']);
print('Number of quotes retrieved: ${quotePrice.keys.length}.');
print('Number of attributes retrieved for KO: ${quotePrice['KO'].keys.length}.');
print('Current market price for KO: ${quotePrice['KO']['price']}.');
print('Number of attributes retrieved for GOOG : ${quotePrice['GOOG'].keys.length}.');
print('Current market price for KO: ${quotePrice['GOOG']['price']}.');
If you want all available quote data from the selected provider, you can request it with the function call:
finalMap<String, Map<String, dynamic>> cryptoQuoteRaw =
awaitFinanceQuote.getRawData(
quoteProvider: QuoteProvider.coincap, symbols: <String>['bitcoin', 'ethereum']);
print('Number of quotes retrieved: ${cryptoQuoteRaw.keys.length}.');
print('Number of attributes retrieved for bitcoin : ${cryptoQuoteRaw['bitcoin'].keys.length}.');
print('Current market price for bitcoin: ${cryptoQuoteRaw['bitcoin']['priceUsd']}.');
print('Number of attributes retrieved for ethereum: ${cryptoQuoteRaw['ethereum'].keys.length}.');
print('Current market price for ethereum: ${cryptoQuoteRaw['ethereum']['priceUsd']}.');
Supported providers
Yahoo
Morningstar
Coinmarketcap
Coincap
Binance
TERMS & CONDITIONS
Quote information fetched through this module is bound by the quote providers terms and conditions.