alpha_vantage_package 1.0.0

  • Readme
  • Changelog
  • Installing
  • 70

alpha_vantage_package #

A new Flutter package for using alpha vantage api.

You will need your own API key from https://www.alphavantage.co/ (it's free) to use stocks other than MSFT

This was refactored and updated from the original source: https://github.com/jcmelend/flutter_alpha_vantage_api so credits to the maker.

For more information about how the JSON is layed out, visit https://www.alphavantage.co/documentation/

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

Usage #

Add the following import statement where you need to use this package libraries: import 'package:alpha_vantage_package/alpha_vantage_package.dart';

There are four libraries to use to call Alpha Vantage rest api: TimeSeries.dart, SectorPerformances.dart, ForeignExchange.dart, CryptoCurrencies.dart, and TechnicalIndicators.dart.

Example:


import 'package:flutter_test/flutter_test.dart';

import 'package:flutter_alpha_vantage_package/alpha_vantage_package.dart';

void main() async {


  test('Intraday', () async {
    final timeSeries = new TimeSeries("YourAlphaVantageAPIKey");
    //get the hourly time series for Microsoft with to-the-minute updates. You can change this.
    JSONObject json = await timeSeries.getIntraday("MSFT");
    var data = json.getJSONMap()["Time Series (1min)"];

    //convert to map to get specific data like the amount during lcose
    var data2 = Map<String, dynamic>.from(data);
    data2.forEach((k,v) => print(v["4. close"]));

     //Use get method to search entire json for key for stock
    expect(json.get("2. Symbol"), "MSFT");

    // Use map to find stock symbol
    expect(json.getJSONMap()["Meta Data"]["2. Symbol"], "MSFT");
    print(json.getJSONMap());


  });

  test('Intraday', () async {
    final technicalIndicator = new TechnicalIndicators("YourAlphaVantageAPIKey");
    //get SMA for microsoft
    JSONObject json = await technicalIndicator.getSMA("MSFT");

    // Use get method to search entire json for key for stock
    expect(json.get("1: Symbol"), "MSFT");

    // Use map to find stock symbol
    expect(json.getJSONMap()["Meta Data"]["1: Symbol"], "MSFT");
    print(json.getJSONMap());
  });
}

[1.0.0] - February 24th 2020 #

  • Refactored previous package and it now supports Dart 2.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  alpha_vantage_package: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:alpha_vantage_package/alpha_vantage_package.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
50
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Jul 12, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • alpha_vantage_package that is a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

76 out of 76 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/alpha_vantage_client.dart. (-7.24 points)

Analysis of lib/src/alpha_vantage_client.dart reported 15 hints, including:

line 7 col 3: Prefer using /// for doc comments.

line 11 col 9: Name non-constant identifiers using lowerCamelCase.

line 12 col 9: Name non-constant identifiers using lowerCamelCase.

line 13 col 9: Name non-constant identifiers using lowerCamelCase.

line 14 col 9: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/CryptoCurrencies.dart. (-1.99 points)

Analysis of lib/src/CryptoCurrencies.dart reported 4 hints:

line 9 col 10: Name non-constant identifiers using lowerCamelCase.

line 10 col 10: Name non-constant identifiers using lowerCamelCase.

line 11 col 10: Name non-constant identifiers using lowerCamelCase.

line 12 col 10: Name non-constant identifiers using lowerCamelCase.

Format lib/alpha_vantage_package.dart.

Run flutter format to format lib/alpha_vantage_package.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/BaseAPI.dart (Run flutter format to format lib/src/BaseAPI.dart.)
  • lib/src/ForeignExchange.dart (Run flutter format to format lib/src/ForeignExchange.dart.)
  • lib/src/JSONObject.dart (Run flutter format to format lib/src/JSONObject.dart.)
  • lib/src/SectorPerformances.dart (Run flutter format to format lib/src/SectorPerformances.dart.)
  • lib/src/TechnicalIndicators.dart (Run flutter format to format lib/src/TechnicalIndicators.dart.)
  • lib/src/TimeSeries.dart (Run flutter format to format lib/src/TimeSeries.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and alpha_vantage_package.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+4 0.12.1
test ^1.9.4 1.15.2
Transitive dependencies
_fe_analyzer_shared 5.0.0
analyzer 0.39.12
args 1.6.0
async 2.4.2
boolean_selector 2.0.0
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
coverage 0.14.0
crypto 2.1.5
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
http_multi_server 2.2.0
http_parser 3.1.4
io 0.3.4
js 0.6.2
logging 0.11.4
matcher 0.12.8
meta 1.1.8 1.2.2
mime 0.9.6+3
node_interop 1.1.1
node_io 1.1.1
node_preamble 1.4.12
package_config 1.9.3
path 1.7.0
pedantic 1.9.0 1.9.2
pool 1.4.0
pub_semver 1.4.4
shelf 0.7.7
shelf_packages_handler 2.0.0
shelf_static 0.2.8
shelf_web_socket 0.2.3
sky_engine 0.0.99
source_map_stack_trace 2.0.0
source_maps 0.10.9
source_span 1.7.0
stack_trace 1.9.5
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
test_api 0.2.17
test_core 0.3.10
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
vm_service 4.1.0
watcher 0.9.7+15
web_socket_channel 1.1.0
webkit_inspection_protocol 0.7.3
yaml 2.2.1
Dev dependencies
flutter_test