BinanceRestApi class

Constructors

BinanceRestApi()
factory
BinanceRestApi.withKeys({required String apiKey, required String apiSecretKey})
factory

Properties

apiClient ← Client
Exposing setter for mocking capabilities in unit tests
no getter
apiKey String?
The user's API key
getter/setter pair
apiSecretKey String?
The user's API secret key
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
usedWeight int
This variable will track the current IP used weight, that - if high enough - may mean that too many requests has been done.
no setter

Methods

aggregatedTrades({String baseUri = defaultUri, required String symbol, int limit = 100, int? fromId, DateTime? startTime, DateTime? endtime}) Future<List<BinanceAggregatedTrade>>
Will get a specific symbol's aggregated trades using /aggTrades endpoint. If limit is provided, will modify the max number of trades returned. (defaults to 100)
averagePrice({String baseUri = defaultUri, required String symbol}) Future<BinanceAveragePrice>
Will get a specific symbol's current average price.
bookTicker({String baseUri = defaultUri, String? symbol}) Future<List<BinanceBookTicker>>
Will get book ticker(s) for given symbol or all symbols.
buildTradeOrderParams(String symbol, Side side, OrderType type, double quantity, int recvWindow, TimeInForce timeInForce, double? quoteOrderQty, double? price, String? newClientOrderId, double? stopPrice, double? icebergQty, OrderResponseType? newOrderRespType) Map<String, dynamic>
cancelOrder({String baseUri = defaultUri, required String symbol, int? orderId, String? origClientOrderId, String? newClientOrderId, int recvWindow = 5000}) Future<BinanceOrderStatus>
Will ask to cancel a given order.
candlestick({String baseUri = defaultUri, required String symbol, required Interval interval, int limit = 100, DateTime? startTime, DateTime? endtime}) Future<List<BinanceKline>>
Will get a specific symbol's KLines (also known as candlesticks) using /klines endpoint. If limit is provided, will modify the max number of KLines returned. (defaults to 100)
checkApiTime({String baseUri = defaultUri}) Future<int>
Will get Binance's REST API server time using /time endpoint.
computeSignature(String totalParams) String
dayTicker({String baseUri = defaultUri, String? symbol}) Future<List<BinanceDayTicker>>
Will get statistics for the last 24 hours on a specific symbol or all.
dispose() → void
Will dispose any resources used by this class
exchangeInfo({String baseUri = defaultUri, List<String> symbols = const <String>[]}) Future<BinanceExchangeInfo>
Will get by default all Binance's listed symbols using /exchangeInfo endpoint. If symbols is provided, will append query parameter to the GET request in order to filter the result.
getFallbackUri() Future<String>
As per Binance's docs, there are 3 more clusters for API calls with names api1, api2 and api3.
getOrderStatus({String baseUri = defaultUri, required String symbol, int? orderId, String? origClientOrderId, int recvWindow = 5000}) Future<BinanceOrderStatus>
Will query the status of a given order.
historicalTrades({String baseUri = defaultUri, required String symbol, int limit = 100, int? fromId}) Future<List<BinanceTrade>>
Will get a specific symbol's historical trades using /historicalTrades endpoint. If limit is provided, will modify the max number of trades returned. (defaults to 100)
maybeUpdateUsedWeight(Map<String, String> headers) → void
Will check response's headers to update the current requests quota.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orderBook({String baseUri = defaultUri, required String symbol, int limit = 100}) Future<BinanceOrderBook>
Will get a specific symbol's order book using /depth endpoint. If limit is provided, will modify the max number of bids/asks returned and the query weight. (defaults to 100)
ping({String baseUri = defaultUri}) Future<bool>
Will check for Binance's REST API availability using /ping endpoint as recommended.
priceTicker({String baseUri = defaultUri, String? symbol}) Future<List<BinancePriceTicker>>
Will get ticker(s) for current price(s).
sendOrder({String baseUri = defaultUri, required String symbol, Side side = Side.buy, OrderType type = OrderType.limit, TimeInForce timeInForce = TimeInForce.gtc, double? quantity, double? quoteOrderQty, double? price, String? newClientOrderId, double? stopPrice, double? icebergQty, OrderResponseType? newOrderRespType, int recvWindow = 5000, bool dryRun = false}) Future<BinanceTradeResponse>
Will send a trade order to the matching engine.
sendRequest(String baseUri, String resourcePath, {RequestMethod requestMethod = RequestMethod.get, Map<String, dynamic>? queryParameters, bool withKey = false, bool withSignature = false}) Future
Will build an Uri based on params and send a request via the _apiClient.
toString() String
A string representation of this object.
inherited
trades({String baseUri = defaultUri, required String symbol, int limit = 100}) Future<List<BinanceTrade>>
Will get a specific symbol's latests trades using /trades endpoint. If limit is provided, will modify the max number of trades returned. (defaults to 100)

Operators

operator ==(Object other) bool
The equality operator.
inherited