FLUTTER ECOSYSTEM

ismaelJimenez/finance_quote

用于使用 Dart 获取金融报价的基本包。

finance_quote 项目封面
Stars
11
Forks
12
最近推送(UTC)
2019年9月19日
项目状态
未归档
Ismael GitHub avatar
GITHUB User

Ismael ↗

语言Dart

此仓库发布的插件

使用的依赖

依赖清单 8 项

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

A Dart plugin for retrieving financial quote prices.

pub package Build Status

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:

  final Map<String, Map<String, String>> quotePrice =
      await FinanceQuote.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:

  final Map<String, Map<String, String>> quotePrice =
      await FinanceQuote.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:

  final Map<String, Map<String, dynamic>> cryptoQuoteRaw =
      await FinanceQuote.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.