Loan#

class defichain.ocean.Loan(ocean)#
listScheme(size: int = 30, next: str | None = None) [{}]#

Paginate query loan schemes

Parameters:
  • size (int) – (optional) size of scheme to query

  • next (str) – (optional) next set of schemes

Returns:

(json string) {id: str, minColRatio: str, interestRate: str}

Example:

>>> ocean.loan.listScheme()
getScheme(id: str) {}#

Get information about a scheme with given scheme id

Parameters:

id (str) – (required) id of scheme to get

Returns:

(json string) {id: str, minColRatio: str, interestRate: str}

Example:

>>> ocean.loan.getScheme("MIN150")
listCollateralToken(size: int = 30, next: str | None = None) [{}]#

Paginate query loan collateral tokens

Parameters:
  • size (int) – (optional) size of collateral tokens to query

  • next (str) – (optional) next set of collateral tokens

Returns:

(json string) {tokenId: str, token: TokenData, factor: str, activateAfterBlock: int, fixedIntervalPriceId: str, activePrice: ActivePrice}

Example:

>>> ocean.loan.listCollateralToken()
getCollateralToken(id: str) {}#

Get information about a collateral token with given collateral token id

Parameters:

id (str) – (required) id of collateral token to get

Returns:

(json string) {tokenId: str, token: TokenData, factor: str, activateAfterBlock: int, fixedIntervalPriceId: str, activePrice: ActivePrice}

Example:

>>> ocean.loan.getCollateralToken()
listLoanToken(size: int = 30, next: str | None = None) [{}]#

Paginate query loan tokens

Parameters:
  • size (int) – (optional) size of loan token to query

  • next (str) – (optional) next set of loan tokens

Returns:

(json string) {tokenId: str, token: TokenData, interest: str, fixedIntervalPriceId: str, activePrice: ActivePrice}

Example:

>>> ocean.loan.listLoanToken()
getLoanToken(id: str) {}#

Get information about a loan token with given loan token id

Parameters:

id (str) – (required) id of loanToken to get

Returns:

(json string) {tokenId: str, token: TokenData, interest: str, fixedIntervalPriceId: str, activePrice: ActivePrice}

Example:

>>> ocean.loan.getLoanToken("0")
listVault(size: int = 30, next: str | None = None) [{}]#

Paginate query loan vaults

Parameters:
  • size (int) – (optional) size of vaults to query

  • next (str) – (optional) next set of vaults

Returns:

(json string) VaultActive or VaultLiquidated

Example:

>>> ocean.loan.listVault()
getVault(id: str) {}#

Get information about a vault with given vault id

Parameters:

id (str) – (required) id of vault to get

Returns:

(json string) VaultActive or VaultLiquidated

Example:

>>> ocean.loan.getVault("8f87baa094aa166cf88dd61553ad996ea2c1f7694536c18f3d8390e436900300")
listVaultAuctionHistory(id: str, height: int, batchIndex: int, size: int = 30, next: str | None = None) [{}]#

List vault auction history

Parameters:
  • id (str) – (required) vaultId

  • height (int) – (required) liquidation height

  • batchIndex (int) – (required) batch index

  • size (int) – (optional) size of auction batch index history

  • next (str) – (optional) next set of auction batch index history

Returns:

(json string) {id: string, key: string, sort: string, vaultId: string, index: number, from: string, address: string, amount: string, tokenId: number, block: {hash: string, height: number, time: number, medianTime: number}}

Example:

>>> ocean.loan.listVaultAuctionHistory("866889122ba23be0a71fc6a9e853d6b8f2b42b018393f091922be5ebcc23b600", 0, 0)
listAuction(size: int = 30, next: str | None = None) [{}]#

Paginate query loan auctions

Parameters:
  • size (int) – (optional) size of auctions to query

  • next (str) – (optional) next set of auctions

Returns:

(json string) {vaultId: string, loanScheme: LoanScheme, ownerAddress: string, state: LoanVaultState.IN_LIQUIDATION, liquidationHeight: number, liquidationPenalty: number, batchCount: number, batches: LoanVaultLiquidationBatch[]}

Example:

>>> ocean.loan.listAuction()