kraken_api 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 57

Kraken API #

Dart Library for the Kraken API. (https://www.kraken.com/features/api).

Getting Started #

Add the package to your pubspec.yaml:

 kraken_api: ^1.0.2

In your dart file, import the library:

import 'package:kraken_api/kraken_api.dart';

Usage #

First create an KrakenApi instance:

 KrakenApi api = KrakenApi('apiKey', 'secretKey');

The constructor requires the API-Key and the Secret-Key which should be both generated on the kraken website.

For accessing the kraken API use the call method. As the first parameter pass the method which should be called. A list of all available requests is added at the end. Request parameters can be added to the request by the parameters parameter:

Future<String> response = api.call(Methods.TRADE_BALANCE, parameters: {'asset': 'ZEUR'});

Hint: To see which parameters can be applied to which API calls take a look at the Kraken API.

The call method returns the response body as an Future<String> which can be accessed through e.g.:

response.then(
    (body) {
        Map<String, dynamic> tradeBalances = jsonDecode(body)['result'];
        return tradeBalances;
    },
);

API #

Public methods:

Methods.TIME 
Methods.ASSETS
Methods.ASSET_PAIRS 
Methods.TICKER 
Methods.OHLC 
Methods.DEPTH 
Methods.TRADES
Methods.SPREAD 

Private methods:

Methods.BALANCE
Methods.TRADE_BALANCE
Methods.OPEN_ORDERS 
Methods.CLOSED_ORDERS 
Methods.QUERY_ORDERS
Methods.TRADES_HISTORY 
Methods.QUERY_TRADES 
Methods.OPEN_POSITIONS 
Methods.LEDGERS 
Methods.QUERY_LEDGERS
Methods.TRADE_VOLUME 
Methods.ADD_EXPORT
Methods.EXPORT_STATUS 
Methods.RETRIEVE_EXPORT 
Methods.REMOVE_EXPORT 
Methods.ADD_ORDER
Methods.CANCEL_ORDER 

[1.0.0] - 13.09.2019

  • Initial release.

[1.0.1] - 15.09.2019

  • Improved documentation.

[1.0.2] - 15.09.2019

  • Bugfix: Fixed request URL.

example/example.dart

import 'dart:convert';

import 'package:kraken_api/kraken_api.dart';

void main() {
  var api = KrakenApi('apiKey', 'secretKey');
  Future<String> response =
      api.call(Methods.TRADE_BALANCE, parameters: {'asset': 'ZEUR'});

  response.then(
    (body) {
      Map<String, dynamic> tradeBalances = jsonDecode(body)['result'];
      return tradeBalances;
    },
  );
}

Use this package as a library

1. Depend on it

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


dependencies:
  kraken_api: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:kraken_api/kraken_api.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
14
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:kraken_api/kraken_api.dart with components: io.

Health issues and suggestions

Document public APIs. (-1 points)

38 out of 38 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.

Format lib/kraken_api.dart.

Run dartfmt to format lib/kraken_api.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
crypto ^2.1.2 2.1.3
http ^0.12.0+2 0.12.0+2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.3.0