flutter_satang_pro_exchange 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

Flutter Satang Pro Exchange #

Flutter Satang Pro Exchange is a Flutter's library for calling API of the https://https://satang.pro

Installation #

Add dependencies in pubspec.yaml

flutter_satang_pro_exchange: 1.1.0

Usage #

Import the package to your project.

import 'package:flutter_satang_pro_exchange/satang_pro_exchange.dart';

Using Public API #

Create instance without API Key.

var sp = SatangProExchangeService();

Get Market cap. #

last coin price , volume , percent change.

  var market = await sp.fetchMarket();

Get Open Order in Market #

Get market open order bids and asks.

This is a public API. you can access JSON in https://api.tdax.com/api/orders/?pair=btc_thb directly.

  SatangProMarketOpenOrdersDao market = await sp.fetchMarketOpenOrders(pair: "btc_thb");
  var bids = market.bids; // list sell order.
  var asks = market.asks; // list buy order.

Get price and amount in order.

  for(var order in bids){
    // order.price;
    // order.amount;

Prepare Private API #

Prepare 2 API keys with different permissions and trying to look your USER ID. Go to Developer Menu then create API KEY.

1. User Information API key #

This API key are used for reading general information, such as balance, wallet address.

required permissions : READ WALLET , READ USER INFO.

2. Order's API key #

Crate Order API key are used for creating order, such as balance, cancel orders ,

required permissions : READ/WRITE ORDER.

Using Private API #

Create instance with 2 API keys and user id. Your user id will be in Developer Menu.

var sp = SatangProExchangeService(
                userId: 7892,
                apiKeyUserInfo: SatangProApiKey(apiKey: "---", secret: "---"),
                apiKeyOrder: SatangProApiKey(apiKey: "---", secret: "---"));

Get User Information and Wallet #

Return user information such as email, user id , verify level and wallet data.

  var userInfo = await sp.fetchUserInformation();
    // userInfo.email;
    // userInfo.id;
    // userInfo.identityVerificationLevel;
    // userInfo.wallets;
    // userInfo.identity;
    // userInfo.error.code;
    // userInfo.error.message;

Get balance and wallet's addresses.

     var wallets = userInfo.wallets.list;
     for(var wallet in wallets){
       // wallet.currency;   // BTC
       // wallet.availableBalance;  // 0.001
       /// wallet.addresses; // 365CKrHsS8gqMaETsuPVoeUcFxh4nAEaKu

Get Order List #

Get current order and order history.

Order Type


Using fetch orders.

  var myOrders = await sp.fetchOrders(pair: "btc_thb",orderType: SatangProOrderType.BUY);
    for(var order in myOrders.orders){
      // order.id;
      // order.amount;
      // order.price;
      // order.type;
      // order.status;
      // order.remainingAmount;
    // userInfo.error.code;
    // userInfo.error.message;

Create Order #

Create order to market.

  // create order BUY 0.0005 BTC with 100,000 THB
  var response = await sp.createOrder(pair: "btc_thb",
      orderType: SatangProOrderType.BUY,
      amount: 0.0005,
      price: 100000);

Cancel Order #

Cancel order with order id.

 var response = await sp.cancelOrder(orderId: 1234567);

Other uses #

Suggestions for other uses.

Pairing Currency #

You can use the atangProCurrency class instead of pair text.


var market = await sp.fetchMarketOpenOrders(pair: SatangProCurrency.BTC_THB);

Pair supported.


display JSON response on console or logcat.

await sp.fetchMarketOpenOrders(printJson: true);

More #

This package is UNOFFICIAL and the developer is not related with Satang.pro site.

1.1.0 #

Add marketcap API.

1.0.2 #

Fix balance bug.

1.0.1 #

Return response when create/cancel order.

1.0.0 #

Wallet API.


import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_exchange.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_order_type.dart';

Future main() async {

  SatangProExchangeService sp = SatangProExchangeService(
      userId: 7892,
      apiKeyUserInfo: SatangProApiKey(apiKey: "", secret: ""));

  await sp.fetchMarket(printJson: true);


class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  void initState() {

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('SATANG PRO'),
        body: Center(
          child: Text('SATANG PRO'),

Use this package as a library

1. Depend on it

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

  flutter_satang_pro_exchange: ^1.1.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:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart';
import 'package:flutter_satang_pro_exchange/dao/errors/satang_pro_error_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/errors/satang_pro_response_error_support.dart';
import 'package:flutter_satang_pro_exchange/dao/market_open_order/satang_pro_market_open_orders_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/market_open_order/satang_pro_open_order_item_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/satang_pro_currency_pair_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/satang_pro_market_cap_currency_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/identity/satang_pro_user_address_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/identity/satang_pro_user_district_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/identity/satang_pro_user_province_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/identity/satang_pro_user_sub_district_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/satang_pro_user_identity_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/satang_pro_user_information_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/satang_pro_user_limit_currency_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/satang_pro_user_limit_currency_item_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_information/satang_pro_user_wallet_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_open_orders/satang_pro_user_open_order_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/user_open_orders/satang_pro_user_open_order_item_dao.dart';
import 'package:flutter_satang_pro_exchange/dao/wallets/satang_pto_wallet_dao.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_auth_utils.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_currency.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_currency_pair.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_exchange.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_open_order_type.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_order_type.dart';
import 'package:flutter_satang_pro_exchange/satang_pro_utils.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:flutter_satang_pro_exchange/dao/api_key/satang_pro_api_key.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [flutter_satang_pro_exchange] that is in a package requiring null.

Health suggestions

Fix lib/dao/user_information/satang_pro_user_information_dao.dart. (-0.50 points)

Analysis of lib/dao/user_information/satang_pro_user_information_dao.dart reported 1 hint:

line 1 col 8: Unused import: 'package:flutter_satang_pro_exchange/dao/errors/satang_pro_error_dao.dart'.

Fix lib/satang_pro_auth_utils.dart. (-0.50 points)

Analysis of lib/satang_pro_auth_utils.dart reported 1 hint:

line 1 col 8: Unused import: 'dart:convert'.

Fix lib/satang_pro_currency_pair.dart. (-0.50 points)

Analysis of lib/satang_pro_currency_pair.dart reported 1 hint:

line 4 col 48: Name non-constant identifiers using lowerCamelCase.

Fix additional 18 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/satang_pro_exchange.dart (1 hint)
  • lib/dao/api_key/satang_pro_api_key.dart (Run flutter format to format lib/dao/api_key/satang_pro_api_key.dart.)
  • lib/dao/errors/satang_pro_error_dao.dart (Run flutter format to format lib/dao/errors/satang_pro_error_dao.dart.)
  • lib/dao/market_open_order/satang_pro_market_open_orders_dao.dart (Run flutter format to format lib/dao/market_open_order/satang_pro_market_open_orders_dao.dart.)
  • lib/dao/market_open_order/satang_pro_open_order_item_dao.dart (Run flutter format to format lib/dao/market_open_order/satang_pro_open_order_item_dao.dart.)
  • lib/dao/satang_pro_currency_pair_dao.dart (Run flutter format to format lib/dao/satang_pro_currency_pair_dao.dart.)
  • lib/dao/user_information/identity/satang_pro_user_address_dao.dart (Run flutter format to format lib/dao/user_information/identity/satang_pro_user_address_dao.dart.)
  • lib/dao/user_information/identity/satang_pro_user_district_dao.dart (Run flutter format to format lib/dao/user_information/identity/satang_pro_user_district_dao.dart.)
  • lib/dao/user_information/identity/satang_pro_user_province_dao.dart (Run flutter format to format lib/dao/user_information/identity/satang_pro_user_province_dao.dart.)
  • lib/dao/user_information/identity/satang_pro_user_sub_district_dao.dart (Run flutter format to format lib/dao/user_information/identity/satang_pro_user_sub_district_dao.dart.)
  • lib/dao/user_information/satang_pro_user_identity_dao.dart (Run flutter format to format lib/dao/user_information/satang_pro_user_identity_dao.dart.)
  • lib/dao/user_information/satang_pro_user_limit_currency_dao.dart (Run flutter format to format lib/dao/user_information/satang_pro_user_limit_currency_dao.dart.)
  • lib/dao/user_information/satang_pro_user_limit_currency_item_dao.dart (Run flutter format to format lib/dao/user_information/satang_pro_user_limit_currency_item_dao.dart.)
  • lib/dao/user_open_orders/satang_pro_user_open_order_dao.dart (Run flutter format to format lib/dao/user_open_orders/satang_pro_user_open_order_dao.dart.)
  • lib/dao/user_open_orders/satang_pro_user_open_order_item_dao.dart (Run flutter format to format lib/dao/user_open_orders/satang_pro_user_open_order_item_dao.dart.)
  • lib/dao/wallets/satang_pto_wallet_dao.dart (Run flutter format to format lib/dao/wallets/satang_pto_wallet_dao.dart.)
  • lib/satang_pro_currency.dart (Run flutter format to format lib/satang_pro_currency.dart.)
  • lib/satang_pro_open_order_type.dart (Run flutter format to format lib/satang_pro_open_order_type.dart.)

Maintenance suggestions

The package description is too short. (-3 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.1
pointycastle ^1.0.1 1.0.2
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0 1.9.1
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies