Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::margin_trading::rest_api::BorrowRepayApi Class Reference

#include <borrow_repay_api.hpp>

Public Member Functions

 BorrowRepayApi (std::shared_ptr< common::RestClient > client)
common::RestApiResponse< std::vector< GetFutureHourlyInterestRateResponseInner > > get_future_hourly_interest_rate (const GetFutureHourlyInterestRateParams &params) const
 Get future hourly interest rate (USER_DATA).
template<class CompletionToken>
auto async_get_future_hourly_interest_rate (const GetFutureHourlyInterestRateParams &params, CompletionToken &&token) const
 Asynchronous get_future_hourly_interest_rate().
common::RestApiResponse< GetInterestHistoryResponse > get_interest_history (const GetInterestHistoryParams &params={}) const
 Get Interest History (USER_DATA).
template<class CompletionToken>
auto async_get_interest_history (const GetInterestHistoryParams &params, CompletionToken &&token) const
 Asynchronous get_interest_history().
common::RestApiResponse< MarginAccountBorrowRepayResponse > margin_account_borrow_repay (const MarginAccountBorrowRepayParams &params) const
 Margin account borrow/repay (USER_DATA).
template<class CompletionToken>
auto async_margin_account_borrow_repay (const MarginAccountBorrowRepayParams &params, CompletionToken &&token) const
 Asynchronous margin_account_borrow_repay().
common::RestApiResponse< QueryBorrowRepayRecordsInMarginAccountResponse > query_borrow_repay_records_in_margin_account (const QueryBorrowRepayRecordsInMarginAccountParams &params) const
 Query borrow/repay records in Margin account (USER_DATA).
template<class CompletionToken>
auto async_query_borrow_repay_records_in_margin_account (const QueryBorrowRepayRecordsInMarginAccountParams &params, CompletionToken &&token) const
 Asynchronous query_borrow_repay_records_in_margin_account().
common::RestApiResponse< std::vector< QueryMarginInterestRateHistoryResponseInner > > query_margin_interest_rate_history (const QueryMarginInterestRateHistoryParams &params) const
 Query Margin Interest Rate History (USER_DATA).
template<class CompletionToken>
auto async_query_margin_interest_rate_history (const QueryMarginInterestRateHistoryParams &params, CompletionToken &&token) const
 Asynchronous query_margin_interest_rate_history().
common::RestApiResponse< QueryMaxBorrowResponse > query_max_borrow (const QueryMaxBorrowParams &params) const
 Query Max Borrow (USER_DATA).
template<class CompletionToken>
auto async_query_max_borrow (const QueryMaxBorrowParams &params, CompletionToken &&token) const
 Asynchronous query_max_borrow().

Constructor & Destructor Documentation

◆ BorrowRepayApi()

binance::margin_trading::rest_api::BorrowRepayApi::BorrowRepayApi ( std::shared_ptr< common::RestClient > client)
explicit

Member Function Documentation

◆ get_future_hourly_interest_rate()

common::RestApiResponse< std::vector< GetFutureHourlyInterestRateResponseInner > > binance::margin_trading::rest_api::BorrowRepayApi::get_future_hourly_interest_rate ( const GetFutureHourlyInterestRateParams & params) const
nodiscard

Get future hourly interest rate (USER_DATA).

GET /sapi/v1/margin/next-hourly-interest-rate.

Get future hourly interest rate

Weight(IP): 100

Security Type: USER_DATA

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#get-future-hourly-interest-rate

◆ async_get_future_hourly_interest_rate()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_get_future_hourly_interest_rate ( const GetFutureHourlyInterestRateParams & params,
CompletionToken && token ) const
inline

Asynchronous get_future_hourly_interest_rate().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetFutureHourlyInterestRateResponseInner>>).

◆ get_interest_history()

common::RestApiResponse< GetInterestHistoryResponse > binance::margin_trading::rest_api::BorrowRepayApi::get_interest_history ( const GetInterestHistoryParams & params = {}) const
nodiscard

Get Interest History (USER_DATA).

GET /sapi/v1/margin/interestHistory.

Get Interest History

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • Response in descending order
  • If isolatedSymbol is not sent, crossed margin data will be returned
  • The max interval between startTime and endTime is 30 days. It is a MUST to ensure data correctness.
  • If startTimeand endTime not sent, return records of the last 7 days by default.
  • If startTime is sent and endTime is not sent, return records of [max(startTime, now-30d), now].
  • If startTime is not sent and endTime is sent, return records of [endTime-7, endTime]
  • type in response has 4 enums:
  • PERIODIC interest charged per hour
  • ON_BORROW first interest charged on borrow
  • PERIODIC_CONVERTED interest charged per hour converted into BNB
  • ON_BORROW_CONVERTED first interest charged on borrow converted into BNB
  • PORTFOLIO interest charged daily on the portfolio margin negative balance

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#get-interest-history

◆ async_get_interest_history()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_get_interest_history ( const GetInterestHistoryParams & params,
CompletionToken && token ) const
inline

Asynchronous get_interest_history().

Completes with void(std::exception_ptr, common::RestApiResponse<GetInterestHistoryResponse>).

◆ margin_account_borrow_repay()

common::RestApiResponse< MarginAccountBorrowRepayResponse > binance::margin_trading::rest_api::BorrowRepayApi::margin_account_borrow_repay ( const MarginAccountBorrowRepayParams & params) const
nodiscard

Margin account borrow/repay (USER_DATA).

POST /sapi/v1/margin/borrow-repay.

Margin account borrow/repay

Weight(UID): 1500

Security Type: USER_DATA

Notes:

  • -3045 INSUFFICIENT_INVENTORY: returned when system borrowable inventory is below the requested amount, or when inventory is severely insufficient (all borrow requests rejected regardless of size). Monitor system asset availability and adjust borrow strategy accordingly.
  • -3006 EXCEED_MAX_BORROWABLE: borrow amount exceeds your current max borrowable limit. Query GET /sapi/v1/margin/maxBorrowable and adjust the request.
  • -3012 ASSET_ADMIN_BAN_BORROW: this asset does not currently support borrowing. Query GET /sapi/v1/margin/allAssets for asset borrow availability.
  • -3015 REPAY_EXCEED_LIABILITY: returned in two scenarios — (1) repay amount exceeds your outstanding liability, or (2) the remaining unpaid debt after this repayment would fall below Binance's minimum threshold. Adjust the repay amount accordingly.
  • -3007 HAS_PENDING_TRANSACTION: a borrow/repay transaction is already in progress on this account. Requests are processed in submission order across all assets, and an in-flight request briefly blocks subsequent ones. Typical processing time is ~100ms; space consecutive requests by at least 100ms. Auto-repay orders can also fail silently for this reason — verify outstanding liability after an auto-repay executes.

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#margin-account-borrow-repay

◆ async_margin_account_borrow_repay()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_margin_account_borrow_repay ( const MarginAccountBorrowRepayParams & params,
CompletionToken && token ) const
inline

Asynchronous margin_account_borrow_repay().

Completes with void(std::exception_ptr, common::RestApiResponse<MarginAccountBorrowRepayResponse>).

◆ query_borrow_repay_records_in_margin_account()

common::RestApiResponse< QueryBorrowRepayRecordsInMarginAccountResponse > binance::margin_trading::rest_api::BorrowRepayApi::query_borrow_repay_records_in_margin_account ( const QueryBorrowRepayRecordsInMarginAccountParams & params) const
nodiscard

Query borrow/repay records in Margin account (USER_DATA).

GET /sapi/v1/margin/borrow-repay.

Query borrow/repay records in Margin account

Weight(IP): 10

Security Type: USER_DATA

Notes:

  • txId or startTime must be sent. txId takes precedence.
  • Response in descending order
  • If an asset is sent, data within 30 days before endTime; If an asset is not sent, data within 7 days before endTime
  • If neither startTime nor endTime is sent, the recent 7-day data will be returned.
  • startTime set as endTime - 7 days by default, endTime set as current time by default

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#query-borrow-repay-records-in-margin-account

◆ async_query_borrow_repay_records_in_margin_account()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_query_borrow_repay_records_in_margin_account ( const QueryBorrowRepayRecordsInMarginAccountParams & params,
CompletionToken && token ) const
inline

◆ query_margin_interest_rate_history()

common::RestApiResponse< std::vector< QueryMarginInterestRateHistoryResponseInner > > binance::margin_trading::rest_api::BorrowRepayApi::query_margin_interest_rate_history ( const QueryMarginInterestRateHistoryParams & params) const
nodiscard

Query Margin Interest Rate History (USER_DATA).

GET /sapi/v1/margin/interestRateHistory.

Query Margin Interest Rate History

Weight(IP): 1

Security Type: USER_DATA

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#query-margin-interest-rate-history

◆ async_query_margin_interest_rate_history()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_query_margin_interest_rate_history ( const QueryMarginInterestRateHistoryParams & params,
CompletionToken && token ) const
inline

Asynchronous query_margin_interest_rate_history().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<QueryMarginInterestRateHistoryResponseInner>>).

◆ query_max_borrow()

common::RestApiResponse< QueryMaxBorrowResponse > binance::margin_trading::rest_api::BorrowRepayApi::query_max_borrow ( const QueryMaxBorrowParams & params) const
nodiscard

Query Max Borrow (USER_DATA).

GET /sapi/v1/margin/maxBorrowable.

Query Max Borrow

Weight(IP): 50

Security Type: USER_DATA

Notes:

See https://developers.binance.com/en/docs/catalog/core-trading-margin-trading/api/rest-api/borrow-repay#query-max-borrow

◆ async_query_max_borrow()

template<class CompletionToken>
auto binance::margin_trading::rest_api::BorrowRepayApi::async_query_max_borrow ( const QueryMaxBorrowParams & params,
CompletionToken && token ) const
inline

Asynchronous query_max_borrow().

Completes with void(std::exception_ptr, common::RestApiResponse<QueryMaxBorrowResponse>).