binance_api_dart 1.0.1 binance_api_dart: ^1.0.1 copied to clipboard
Http wrapper for binance api in dart
example/binance_api_dart_example.dart
import 'dart:convert';
import 'package:binance_api_dart/binance_api_dart.dart';
void main() {
BinanceApi binanceApi = BinanceApi(
apiKey: '<YOUR_API_KEY>',
privateKey: '<YOUR_API_KEY>',
baseUrl: 'fapi.binance.com');
// http get example
Map<String, String> getParameters = Map();
getParameters['symbol'] = 'BTC/USDT';
getParameters['interval'] = '5m';
binanceApi.getHttp('/fapi/v1/markPriceKlines', getParameters);
// http post example
Map<String, String> postParameters = Map();
getParameters['symbol'] = 'BTC/USDT';
getParameters['side'] = 'BUY';
getParameters['type'] = 'LIMIT';
binanceApi.postHttp('/fapi/v1/order', postParameters);
// http put example
Map<String, String> putParameters = Map();
binanceApi.postHttp('/fapi/v1/listenKey', putParameters);
// http delete example
Map<String, String> deleteParameters = Map();
binanceApi.postHttp('/fapi/v1/listenKey', putParameters);
//json decoding
binanceApi
.getHttp('/fapi/v1/markPriceKlines', getParameters)
.then((response) {
dynamic decoded = json.decode(response.body);
});
}