flutter_satang_pro_exchange

Last updated:

0 purchases

flutter_satang_pro_exchange Image
flutter_satang_pro_exchange Images
Add to Cart

Description:

flutter satang pro exchange

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
copied to clipboard
Usage #
Import the package to your project.
import 'package:flutter_satang_pro_exchange/satang_pro_exchange.dart';
copied to clipboard
Using Public API #
Create instance without API Key.
var sp = SatangProExchangeService();
copied to clipboard
Get Market cap. #
last coin price , volume , percent change.
var market = await sp.fetchMarket();
market.avg24hr;
market.baseVolume;
market.high24hr;
market.highestBid;
market.last;
market.low24hr;
market.lowestAsk;
market.percentChange;
market.quoteVolume;
}
copied to clipboard
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.
[GET]
https://api.tdax.com/api/orders/?pair=SYMBOL
copied to clipboard
SatangProMarketOpenOrdersDao market = await sp.fetchMarketOpenOrders(pair: "btc_thb");
var bids = market.bids; // list sell order.
var asks = market.asks; // list buy order.
}
copied to clipboard
Get price and amount in order.
for(var order in bids){
// order.price;
// order.amount;
}
}
copied to clipboard
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.
copied to clipboard
2. Order's API key #
Crate Order API key are used for creating order, such as balance, cancel orders ,
required permissions : READ/WRITE ORDER.
copied to clipboard
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: "---"));
copied to clipboard
Get User Information and Wallet #
Return user information such as email, user id , verify level and wallet data.
var userInfo = await sp.fetchUserInformation();
if(!userInfo.isError){
// userInfo.email;
// userInfo.id;
// userInfo.identityVerificationLevel;
// userInfo.wallets;
// userInfo.identity;
}else{
// userInfo.error.code;
// userInfo.error.message;
}
copied to clipboard
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
}
copied to clipboard
Get Order List #
Get current order and order history.
Order Type
SatangProOrderType.BUY
SatangProOrderType.SELL
copied to clipboard
Using fetch orders.
var myOrders = await sp.fetchOrders(pair: "btc_thb",orderType: SatangProOrderType.BUY);
if(!myOrders.isError){
for(var order in myOrders.orders){
// order.id;
// order.amount;
// order.price;
// order.type;
// order.status;
// order.remainingAmount;
}
}else{
// userInfo.error.code;
// userInfo.error.message;
}
copied to clipboard
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);
copied to clipboard
Cancel Order #
Cancel order with order id.
var response = await sp.cancelOrder(orderId: 1234567);
copied to clipboard
Other uses #
Suggestions for other uses.
Pairing Currency #
You can use the atangProCurrency class instead of pair text.
Example
var market = await sp.fetchMarketOpenOrders(pair: SatangProCurrency.BTC_THB);
copied to clipboard
Pair supported.
BTC_THB
ETH_THB
USDT_THB
XLM_THB
XRP_THB
XZC_THB
copied to clipboard
Print JSON #
display JSON response on console or logcat.
await sp.fetchMarketOpenOrders(printJson: true);
copied to clipboard
More #
This package is UNOFFICIAL and the developer is not related with Satang.pro site.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.