ByBitRest class

Constructors

ByBitRest({String url = 'https://api.bybit.com', String key = '', String password = '', Duration? timeout, int receiveWindow = 1000})
Constructor of the REST API communication. The receiveWindow must be given in milliseconds and prevents replay attacks. See https://bybit-exchange.github.io/docs/inverse/?console#t-authentication

Properties

client ↔ Client?
HTTP client that is used for the bybit communication over the REST API todo: not used atm but I should!
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
key String
Your bybit api-key
final
log LoggerSingleton
For easy debugging
getter/setter pair
password String
Your api-key password
final
receiveWindow int
Receive window in milliseconds. See https://bybit-exchange.github.io/docs/inverse/?console#t-authentication
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
streamGroup ↔ StreamGroup<Map<String, dynamic>?>?
Group all periodic REST calls stream
getter/setter pair
streamList List<Stream<Map<String, dynamic>>>
Contains a list of periodic REST calls streams. These streams are merged together into one stream when the connect() function is called
getter/setter pair
timeout Duration?
Timeout value
getter/setter pair
url String
Url to use for the REST requests. List of all entpoints at: https://bybit-exchange.github.io/docs/inverse/?console#t-authentication
final

Methods

cancelActiveOrder({required String symbol, String? orderId, String? orderLinkId}) Future<Map<String, dynamic>?>
Cancel active order. Note that either orderId or orderLinkId are required https://bybit-exchange.github.io/docs/inverse/#t-cancelactive
cancelActiveOrderPeriodic({required String symbol, String? orderId, String? orderLinkId, required Duration period}) → void
Cancel active order periodically. Note that either orderId or orderLinkId are required https://bybit-exchange.github.io/docs/inverse/#t-cancelactive
cancelAllActiveOrders({required String symbol}) Future<Map<String, dynamic>?>
Cancel all active orders that are unfilled or partially filled. Fully filled orders cannot be cancelled. https://bybit-exchange.github.io/docs/inverse/#t-cancelallactive
cancelAllActiveOrdersPeriodic({required String symbol, required Duration period}) → void
Cancel all active orders that are unfilled or partially filled periodically. Fully filled orders cannot be cancelled. https://bybit-exchange.github.io/docs/inverse/#t-cancelallactive
cancelAllConditionalOrders({required String symbol}) Future<Map<String, dynamic>?>
Cancel all untriggered conditional orders. https://bybit-exchange.github.io/docs/inverse/#t-cancelallcond
cancelAllConditionalOrdersPeriodic({required String symbol, required Duration period}) → void
Cancel all untriggered conditional orders periodically. https://bybit-exchange.github.io/docs/inverse/#t-cancelallcond
cancelConditionalOrder({required String symbol, String? orderId, String? orderLinkId}) Future<Map<String, dynamic>?>
Cancel untriggered conditional order. https://bybit-exchange.github.io/docs/inverse/#t-cancelcond
cancelConditionalOrderPeriodic({required String symbol, String? orderId, String? orderLinkId, required Duration period}) → void
Cancel untriggered conditional order periodically. https://bybit-exchange.github.io/docs/inverse/#t-cancelcond
connect() bool
Connect a HTTP client to the server
crossIsolatedMarginSwitch({required String symbol, required bool isIsolated, required double buyLeverage, required double sellLeverage}) Future<Map<String, dynamic>?>
Switch Cross/Isolated; must set leverage value when switching from Cross to Isolated. https://bybit-exchange.github.io/docs/inverse/#t-marginswitch
disconnect() → void
Disconnect the HTTP client
fullPartialPositionTPSLSwitch({required String symbol, required String tpSlMode}) Future<Map<String, dynamic>?>
Full/Partial Position TP/SL Switch : Switch mode between Full or Partial https://bybit-exchange.github.io/docs/inverse/#t-switchmode
getActiveOrder({required String symbol, String? orderStatus, String? direction, int? limit, String? cursor}) Future<Map<String, dynamic>?>
Get active order https://bybit-exchange.github.io/docs/inverse/?console#t-getactive
getActiveOrderPeriodic({required String symbol, String? orderStatus, String? direction, int? limit, String? cursor, required Duration period}) → void
Get active order periodically https://bybit-exchange.github.io/docs/inverse/?console#t-getactive
getAnnouncement() Future<Map<String, dynamic>?>
Get Bybit OpenAPI announcements in the last 30 days in reverse order. https://bybit-exchange.github.io/docs/inverse/?console#t-announcement
getAnnouncementPeriodic({required Duration period}) → void
Get Bybit OpenAPI announcements in the last 30 days in reverse order periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-announcement
getApiKeyInfo() Future<Map<String, dynamic>?>
Get user's API key information. https://bybit-exchange.github.io/docs/inverse/#t-key
getApiKeyInfoPeriodic({required Duration period}) → void
Get user's API key information periodically. https://bybit-exchange.github.io/docs/inverse/#t-key
getAssetExchangeRecords({String? direction, int? from, int? limit}) Future<Map<String, dynamic>?>
Get asset exchange records. https://bybit-exchange.github.io/docs/inverse/#t-assetexchangerecords
getAssetExchangeRecordsPeriodic({String? direction, int? from, int? limit, required Duration period}) → void
Get asset exchange records periodically. https://bybit-exchange.github.io/docs/inverse/#t-assetexchangerecords
getConditionalOrder({required String symbol, String? stopOrderId, String? orderLinkId}) Future<Map<String, dynamic>?>
Query conditional order. https://bybit-exchange.github.io/docs/inverse/#t-querycond
getConditionalOrderPeriodic({required String symbol, String? stopOrderId, String? orderLinkId, required Duration period}) → void
Query conditional order periodically. https://bybit-exchange.github.io/docs/inverse/#t-querycond
getConditionalOrders({required String symbol, String? stopOrderStatus, String? direction, int? limit, String? cursor}) Future<Map<String, dynamic>?>
Get user conditional order list. https://bybit-exchange.github.io/docs/inverse/#t-getcond
getConditionalOrdersPeriodic({required String symbol, String? stopOrderStatus, String? direction, int? limit, String? cursor, required Duration period}) → void
Get user conditional order list periodically. https://bybit-exchange.github.io/docs/inverse/#t-getcond
getFundingRate({required String symbol}) Future<Map<String, dynamic>?>
Get the last funding rate. https://bybit-exchange.github.io/docs/inverse/#t-fundingrate
getFundingRatePeriodic({required String symbol, required Duration period}) → void
Get the last funding rate periodically. https://bybit-exchange.github.io/docs/inverse/#t-fundingrate
getKLine({required String symbol, required String interval, required int from, int limit = -1}) Future<Map<String, dynamic>?>
Get kline. https://bybit-exchange.github.io/docs/inverse/?console#t-querykline
getKLinePeriodic({required String symbol, required String interval, required int from, int? limit = -1, required Duration period}) → void
Get kline periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-querykline
getLatestBigDeals({required String symbol, int? limit}) Future<Map<String, dynamic>?>
Obtain filled orders worth more than 500,000 USD within the last 24h.
getLatestBigDealsPeriodic({required String symbol, int? limit, required Duration period}) → void
Obtain filled orders worth more than 500,000 USD within the last 24h, periodically.
getLongShortRatio({required String symbol, required String interval, int? limit}) Future<Map<String, dynamic>?>
Gets the Bybit user accounts' long-short ratio.
getLongShortRatioPeriodic({required String symbol, required String interval, int? limit, required Duration period}) → void
Gets the Bybit user accounts' long-short ratio periodically
getMarkPriceKLine({required String symbol, required String interval, required int from, int? limit}) Future<Map<String, dynamic>?>
Query mark price kline (like Query Kline but for mark price).
getMarkPriceKLinePeriodic({required String symbol, required String interval, required int from, int? limit, required Duration period}) → void
Query mark price kline (like Query Kline but for mark price) periodically
getOpenInterest({required String symbol, required String interval, int? limit}) Future<Map<String, dynamic>?>
Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions.
getOpenInterestPeriodic({required String symbol, required String interval, int? limit, required Duration period}) → void
Gets the total amount of unsettled contracts periodically. In other words, get the total number of contracts held in open positions every period.
getOrderBook({required String symbol}) Future<Map<String, dynamic>?>
Get the orderbook. https://bybit-exchange.github.io/docs/inverse/?console#t-orderbook
getOrderBookPeriodic({required String symbol, required Duration period}) → void
Add a periodic call to the order book REST API. https://bybit-exchange.github.io/docs/inverse/?console#t-orderbook
getPosition({String? symbol}) Future<Map<String, dynamic>?>
Get user position list. https://bybit-exchange.github.io/docs/inverse/?console#t-myposition
getPositionPeriodic({String? symbol, required Duration period}) → void
Get user position list periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-myposition
getPredictedFundingRateAndFundingFee({required String symbol}) Future<Map<String, dynamic>?>
Get predicted funding rate and my funding fee. https://bybit-exchange.github.io/docs/inverse/#t-predictedfunding
getPredictedFundingRateAndFundingFeePeriodic({required String symbol, required Duration period}) → void
Get predicted funding rate and my funding fee periodically. https://bybit-exchange.github.io/docs/inverse/#t-predictedfunding
getPreviousFundingFee({required String symbol}) Future<Map<String, dynamic>?>
Get previous funding fee. https://bybit-exchange.github.io/docs/inverse/#t-mylastfundingfee
getPreviousFundingFeePeriodic({required String symbol, required Duration period}) → void
Get previous funding fee periodically. https://bybit-exchange.github.io/docs/inverse/#t-mylastfundingfee
getRealTimeActiveOrder({required String symbol, String? orderId, String? orderLinkId}) Future<Map<String, dynamic>?>
Query real-time active order information. https://bybit-exchange.github.io/docs/inverse/#t-queryactive
getRealTimeActiveOrderPeriodic({required String symbol, String? orderId, String? orderLinkId, required Duration period}) → void
Query real-time active order information periodically. https://bybit-exchange.github.io/docs/inverse/#t-queryactive
getRiskLimit() Future<Map<String, dynamic>?>
Get risk limit. https://bybit-exchange.github.io/docs/inverse/#t-risklimit
getRiskLimitPeriodic({required Duration period}) → void
Get risk limit periodically. https://bybit-exchange.github.io/docs/inverse/#t-risklimit
getServerTime() Future<Map<String, dynamic>?>
Get the server time (used for synchronization purposes for example). https://bybit-exchange.github.io/docs/inverse/?console#t-servertime
getServerTimePeriodic({required Duration period}) → void
Get the server time (used for synchronization purposes for example) periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-servertime
getSymbolsInfo() Future<Map<String, dynamic>?>
Get the information for all symbols. https://bybit-exchange.github.io/docs/inverse/?console#t-querysymbol
getSymbolsInfoPeriodic({required Duration period}) → void
Get the information for all symbols periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-querysymbol
getTickers({String? symbol}) Future<Map<String, dynamic>?>
Get the latest information for symbol. https://bybit-exchange.github.io/docs/inverse/?console#t-latestsymbolinfo
getTickersPeriodic({String? symbol, required Duration period}) → void
Get the latest information for symbols periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-latestsymbolinfo
getTradingFeeRate({required String symbol}) Future<Map<String, dynamic>?>
Query Trading Fee Rate https://bybit-exchange.github.io/docs/inverse/#t-queryfeerate
getTradingRecords({required String symbol, int? limit}) Future<Map<String, dynamic>?>
Get recent trades.
getTradingRecordsPeriodic({required String symbol, int? from, int? limit, required Duration period}) → void
Get recent trades periodically.
getUserClosedProfit({required String symbol, int? startTime, int? endTime, String? execType, int? page, int? limit}) Future<Map<String, dynamic>?>
Get user's closed profit and loss records. https://bybit-exchange.github.io/docs/inverse/#t-closedprofitandloss
getUserClosedProfitPeriodic({required String symbol, int? startTime, int? endTime, String? execType, int? page, int? limit, required Duration period}) → void
Get user's closed profit and loss records periodically. https://bybit-exchange.github.io/docs/inverse/#t-closedprofitandloss
getUserLCP({required String symbol}) Future<Map<String, dynamic>?>
Get user's LCP (data refreshes once an hour). https://bybit-exchange.github.io/docs/inverse/#t-lcp
getUserLCPPeriodic({required String symbol, required Duration period}) → void
Get user's LCP (data refreshes once an hour) periodically. https://bybit-exchange.github.io/docs/inverse/#t-lcp
getUserTradingRecords({required String symbol, String? orderId, int? startTime, int? page, int? limit, String? order}) Future<Map<String, dynamic>?>
Get user's trading records. https://bybit-exchange.github.io/docs/inverse/#t-usertraderecords
getUserTradingRecordsPeriodic({required String symbol, String? orderId, int? startTime, int? page, int? limit, String? order, required Duration period}) → void
Get user's trading records periodically. https://bybit-exchange.github.io/docs/inverse/#t-usertraderecords
getWalletBalance({String? currency}) Future<Map<String, dynamic>?>
Get wallet balance. https://bybit-exchange.github.io/docs/inverse/#t-wallet
getWalletBalancePeriodic({String? currency, required Duration period}) → void
Get wallet balance periodically. https://bybit-exchange.github.io/docs/inverse/#t-wallet
getWalletFundRecords({String? currency, int? startTimestamp, int? endTimestamp, String? walletFundType, int? page, int? limit}) Future<Map<String, dynamic>?>
Get wallet fund records. https://bybit-exchange.github.io/docs/inverse/#t-walletrecords
getWalletFundRecordsPeriodic({String? currency, int? startTimestamp, int? endTimestamp, String? walletFundType, int? page, int? limit, required Duration period}) → void
Get wallet fund records periodically. https://bybit-exchange.github.io/docs/inverse/#t-walletrecords
getWithdrawalRecords({String? currency, int? startTimestamp, int? endTimestamp, String? status, int? page, int? limit}) Future<Map<String, dynamic>?>
Get withdrawal records. https://bybit-exchange.github.io/docs/inverse/#t-withdrawrecords
getWithdrawalRecordsPeriodic({String? currency, int? startTimestamp, int? endTimestamp, String? status, int? page, int? limit, required Duration period}) → void
Get withdrawal records periodically. https://bybit-exchange.github.io/docs/inverse/#t-withdrawrecords
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
placeActiveOrder({required String symbol, required String side, required String orderType, required int quantity, required String timeInForce, double? price, double? takeProfit, double? stopLoss, bool? reduceOnly, bool? closeOnTrigger, String? orderLinkId, String? tpTriggerBy, String? slTriggerBy}) Future<Map<String, dynamic>?>
Place active order https://bybit-exchange.github.io/docs/inverse/?console#t-placeactive
placeActiveOrderPeriodic({required String symbol, required String side, required String orderType, required int quantity, required String timeInForce, double? price, double? takeProfit, double? stopLoss, bool? reduceOnly, bool? closeOnTrigger, String? orderLinkId, required Duration period}) → void
Place active order periodically. https://bybit-exchange.github.io/docs/inverse/?console#t-placeactive
placeConditionalOrder({required String symbol, required String side, required String orderType, required int quantity, double? price, required double basePrice, required double triggerPrice, required String timeInForce, String? triggerBy, bool? closeOnTrigger, String? orderLinkId, double? takeProfit, double? stopLoss, String? tpTriggerBy, String? slTriggerBy}) Future<Map<String, dynamic>?>
Place a market price conditional order https://bybit-exchange.github.io/docs/inverse/#t-placecond
placeConditionalOrderPeriodic({required String symbol, required String side, required String orderType, required int quantity, double? price, required double basePrice, required double triggerPrice, required String timeInForce, String? triggerBy, bool? closeOnTrigger, String? orderLinkId, required Duration period}) → void
Place a market price conditional order periodically. https://bybit-exchange.github.io/docs/inverse/#t-placecond
request({required String path, Map<String, dynamic>? parameters, bool withAuthentication = false, String type = 'POST'}) Future<Map<String, dynamic>?>
Send command to Bybit
setLeverage({required String symbol, required double leverage, bool? leverageOnly}) Future<Map<String, dynamic>?>
Set leverage. https://bybit-exchange.github.io/docs/inverse/#t-setleverage
setLeveragePeriodic({required String symbol, required double leverage, required Duration period}) → void
Set leverage periodically. https://bybit-exchange.github.io/docs/inverse/#t-setleverage
setMargin({required String symbol, required double margin}) Future<Map<String, dynamic>?>
Update margin. https://bybit-exchange.github.io/docs/inverse/#t-changemargin
setMarginPeriodic({required String symbol, required double margin, required Duration period}) → void
Update margin periodically. https://bybit-exchange.github.io/docs/inverse/#t-changemargin
setRiskLimit({required String symbol, required int riskId}) Future<Map<String, dynamic>?>
Set risk limit. https://bybit-exchange.github.io/docs/inverse/#t-setrisklimit
setRiskLimitPeriodic({required String symbol, required int riskId, required Duration period}) → void
Set risk limit periodically. https://bybit-exchange.github.io/docs/inverse/#t-setrisklimit
setTradingStop({required String symbol, double? takeProfit, double? stopLoss, double? trailingStop, String? tpTriggerBy, String? slTriggerBy, double? newTrailingTriggerPrice, double? tpSize, double? slSize}) Future<Map<String, dynamic>?>
Set trading-stop. https://bybit-exchange.github.io/docs/inverse/#t-tradingstop
setTradingStopPeriodic({required String symbol, double? takeProfit, double? stopLoss, double? trailingStop, String? tpTriggerBy, String? slTriggerBy, double? newTrailingTriggerPrice, required Duration period}) → void
Set trading-stop periodically. https://bybit-exchange.github.io/docs/inverse/#t-tradingstop
sign({required String secret, required SortedMap<Comparable, dynamic> query}) String
Generate a signature needed for the REST authentication as defined here: https://bybit-exchange.github.io/docs/inverse/?console#t-constructingtherequest
toString() String
A string representation of this object.
inherited
updateActiveOrder({required String symbol, String? orderId, String? orderLinkId, int? newOrderQuantity, double? newOrderPrice, double? takeProfit, double? stopLoss, String? tpTriggerBy, String? slTriggerBy}) Future<Map<String, dynamic>?>
Replace order can modify/amend your active orders. https://bybit-exchange.github.io/docs/inverse/#t-replaceactive
updateActiveOrderPeriodic({required String symbol, String? orderId, String? orderLinkId, int? newOrderQuantity, double? newOrderPrice, required Duration period}) → void
Replace order can modify/amend your active orders periodically. https://bybit-exchange.github.io/docs/inverse/#t-replaceactive
updateConditionalOrder({required String symbol, String? stopOrderId, String? orderLinkId, int? newOrderQuantity, double? newOrderPrice, double? newTriggerPrice, double? takeProfit, double? stopLoss, String? tpTriggerBy, String? slTriggerBy}) Future<Map<String, dynamic>?>
Update conditional order. https://bybit-exchange.github.io/docs/inverse/#t-replacecond
updateConditionalOrderPeriodic({required String symbol, String? stopOrderId, String? orderLinkId, int? newOrderQuantity, double? newOrderPrice, double? newTriggerPrice, required Duration period}) → void
Update conditional order periodically. https://bybit-exchange.github.io/docs/inverse/#t-replacecond

Operators

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