binance_api_dart 1.0.1 binance_api_dart: ^1.0.1 copied to clipboard
Http wrapper for binance api in dart
This package aims to simplify the signature creation process for binance api. The package takes any type of parameter and creates the signature before making the http call to the binance api.
Features #
This package help you to manage the http connetion to binance api. It create the signature and do the http calls.
Supported http methods:
- GET
- POST
- PUT
- DELETE
All the methods return a http.Response
type from which you can easily get the json decoded model.
Getting started #
no particular preconditions are required. The package only needs the http package to work. You can add http to your dependecies in this way:
dependencies:
http: ^0.13.3
Usage #
How to use example:
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);
});
Additional information #
This is a very new project, contributions indications coming soon....