# Lend ## Get lending markets `markets.lend.list(LendListParams**kwargs) -> LendListResponse` **get** `/api/v1/markets/lend` Get lending markets ### Parameters - `with_text: Optional[bool]` Include text variation fields - `with_value: Optional[bool]` Calculate and include USD values for amounts, where applicable ### Returns - `class LendListResponse: …` - `count: int` Total number of objects irrespective of any pagination parameters. - `data: List[LendMarket]` - `asset_info: AssetInfo` Asset identifiers with associated metadata - `asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `id: str` - `group: Literal["native", "token"]` - `"native"` - `"token"` - `group_key: str` - `classification: AssetClassification` The asset's classification metadata. Assets are classfied to provide context on their usage throughout the Neptune API (e.g. regular assets, neptune receipt tokens, LSTs, etc.) Each asset belongs to only a single classification type. This object contains metadata pertaining to the given classification. While some fields may be common among the distinct classifcations, each classification is distinct and subject to independent change. - `class Regular: …` - `kind: Literal["regular"]` - `"regular"` - `neptune_receipt_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class NeptuneReceiptToken: …` - `kind: Literal["neptune_receipt_token"]` - `"neptune_receipt_token"` - `origin_asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class LiquidStakingToken: …` - `kind: Literal["liquid_staking_token"]` - `"liquid_staking_token"` - `origin_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `metadata: AssetMetadata` Additional metadata for assets - `decimals_denom: int` Denom exponent, or num. of decimal places that shift between denom/standard amounts (e.g. `18` for `INJ`) - `decimals_display: int` Number of decimals used when displaying amounts of this asset (this is subjective and used for generating text representations) - `name: str` Full name of the asset - `symbol: str` Symbol of the asset, e.g.: `NEPT` `INJ` - `symbol_denom: str` Denom symbol for the asset (e.g. `inj` for `INJ`, `sat` for `BTC`) - `rate: MarketRate` Lending market rates - `apr: str` Market rate in APR standard as a decimal percentage - `apy: str` Market rate in APY standard as a decimal percentage - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `apr: str` - `apy: str` - `state: LendMarketState` Current lending market state - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal_sum: str` - `receipt_total_supply: str` - `redemption_ratio: str` - `value: Optional[ExtraValue]` USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. ### Note This variant group contains an additional `price` field (set to the number used in value calculation). The embedded text group will contain the text variant if `with_text` was specified as well. - `extra: ExtraValueExtra` - `text: Optional[ExtraValueExtraText]` Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. - `price: str` Text representation of price - `principal_sum: str` - `price: str` Price used in value calculations - `principal_sum: str` - `principal_sum: str` The total amount of the asset deposited for lending in the market. - `receipt_total_supply: str` - `redemption_ratio: str` - `error: None` Error data. Guaranteed `null` for successful response. - `status: int` HTTP status. Successful responses are guaranteed to be < `400`. Conversely, error responses are guaranteed to be >= `400`. - `status_text: str` HTTP status text ### Example ```python from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() lends = client.markets.lend.list() print(lends.count) ``` #### Response ```json { "data": [ { "asset_info": { "asset": { "id": "native;inj", "group": "native", "group_key": "inj" }, "metadata": { "name": "Injective", "symbol": "INJ", "symbol_denom": "inj", "decimals_denom": 18, "decimals_display": 4 }, "classification": { "kind": "regular", "neptune_receipt_asset": { "id": "token;inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f", "group": "token", "group_key": "inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f" } } }, "rate": { "apr": "0.29995825", "apy": "0.34980245", "extra": { "text": { "apy": "34.98%", "apr": "29.99%" } } }, "state": { "principal_sum": "425740748412504991838699", "receipt_total_supply": "396952939907783847231686", "redemption_ratio": "1.072521968249961422", "extra": { "text": { "redemption_ratio": "1.0725", "receipt_total_supply": "396,952.9399 nINJ", "principal_sum": "425,740.7484 INJ" }, "value": { "price": "2.99835", "principal_sum": "1276519.773002634342279563", "extra": { "text": { "price": "$2.99", "principal_sum": "$1,276,519.77" } } } } } } ], "count": 1, "error": null, "status": 200, "status_text": "200 OK" } ``` ## Lookup lending market by asset `markets.lend.get_by_asset(LendGetByAssetParams**kwargs) -> LendGetByAssetResponse` **get** `/api/v1/markets/lend/lookup` Lookup lending market by asset ### Parameters - `asset_id: str` Asset ID for lookup - `with_text: Optional[bool]` Include text variation fields - `with_value: Optional[bool]` Calculate and include USD values for amounts, where applicable ### Returns - `class LendGetByAssetResponse: …` - `data: LendMarket` Lending market overview - `asset_info: AssetInfo` Asset identifiers with associated metadata - `asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `id: str` - `group: Literal["native", "token"]` - `"native"` - `"token"` - `group_key: str` - `classification: AssetClassification` The asset's classification metadata. Assets are classfied to provide context on their usage throughout the Neptune API (e.g. regular assets, neptune receipt tokens, LSTs, etc.) Each asset belongs to only a single classification type. This object contains metadata pertaining to the given classification. While some fields may be common among the distinct classifcations, each classification is distinct and subject to independent change. - `class Regular: …` - `kind: Literal["regular"]` - `"regular"` - `neptune_receipt_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class NeptuneReceiptToken: …` - `kind: Literal["neptune_receipt_token"]` - `"neptune_receipt_token"` - `origin_asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class LiquidStakingToken: …` - `kind: Literal["liquid_staking_token"]` - `"liquid_staking_token"` - `origin_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `metadata: AssetMetadata` Additional metadata for assets - `decimals_denom: int` Denom exponent, or num. of decimal places that shift between denom/standard amounts (e.g. `18` for `INJ`) - `decimals_display: int` Number of decimals used when displaying amounts of this asset (this is subjective and used for generating text representations) - `name: str` Full name of the asset - `symbol: str` Symbol of the asset, e.g.: `NEPT` `INJ` - `symbol_denom: str` Denom symbol for the asset (e.g. `inj` for `INJ`, `sat` for `BTC`) - `rate: MarketRate` Lending market rates - `apr: str` Market rate in APR standard as a decimal percentage - `apy: str` Market rate in APY standard as a decimal percentage - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `apr: str` - `apy: str` - `state: LendMarketState` Current lending market state - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal_sum: str` - `receipt_total_supply: str` - `redemption_ratio: str` - `value: Optional[ExtraValue]` USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. ### Note This variant group contains an additional `price` field (set to the number used in value calculation). The embedded text group will contain the text variant if `with_text` was specified as well. - `extra: ExtraValueExtra` - `text: Optional[ExtraValueExtraText]` Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. - `price: str` Text representation of price - `principal_sum: str` - `price: str` Price used in value calculations - `principal_sum: str` - `principal_sum: str` The total amount of the asset deposited for lending in the market. - `receipt_total_supply: str` - `redemption_ratio: str` - `error: None` Error data. Guaranteed `null` for successful response. - `status: int` HTTP status. Successful responses are guaranteed to be < `400`. Conversely, error responses are guaranteed to be >= `400`. - `status_text: str` HTTP status text ### Example ```python from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() response = client.markets.lend.get_by_asset( asset_id="token;-K-//-//3-", ) print(response.data) ``` #### Response ```json { "data": { "asset_info": { "asset": { "id": "native;inj", "group": "native", "group_key": "inj" }, "metadata": { "name": "Injective", "symbol": "INJ", "symbol_denom": "inj", "decimals_denom": 18, "decimals_display": 4 }, "classification": { "kind": "regular", "neptune_receipt_asset": { "id": "token;inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f", "group": "token", "group_key": "inj1rmzufd7h09sqfrre5dtvu5d09ta7c0t4jzkr2f" } } }, "rate": { "apr": "0.21150951", "apy": "0.23554172", "extra": { "text": { "apy": "23.55%", "apr": "21.15%" } } }, "state": { "principal_sum": "425740748412504991838699", "receipt_total_supply": "396952939907783847231686", "redemption_ratio": "1.072521968249961422", "extra": { "text": { "redemption_ratio": "1.0725", "receipt_total_supply": "396,952.9399 nINJ", "principal_sum": "425,740.7484 INJ" }, "value": { "price": "2.99835", "principal_sum": "1276519.773002634342279563", "extra": { "text": { "price": "$2.99", "principal_sum": "$1,276,519.77" } } } } } }, "error": null, "status": 200, "status_text": "200 OK" } ``` ## Get historical lending rates for assets `markets.lend.get_rate_history(LendGetRateHistoryParams**kwargs) -> LendGetRateHistoryResponse` **get** `/api/v1/markets/lend/rate-history` Get historical lending rates for assets ### Parameters - `end: int` End timestamp for interval range (inclusive) Must be provided as unix timestamp (in seconds) - `period: IntervalUnit` Interval period Values: - `h`: Hourly - `d`: Daily (accounts for offsets introduced by DST) - `w`: Weekly (provided for convenience, equivalent to 7d) - `m`: Monthly (accounts for varying \# of days per month) - `y`: Yearly (accounts for varying \# of days per year) E.g. for interval buckets of 2h `interval=2&period=h` - `"h"` - `"d"` - `"w"` - `"m"` - `"y"` - `start: int` Start timestamp for interval range (inclusive) Must be provided as unix timestamp (in seconds) - `asset_ids: Optional[str]` Optional comma-separated list of asset IDs to filter for. If excluded, values will be returned for all assets. - `interval: Optional[int]` Interval value E.g. for interval buckets of 2h: `interval=2&period=h` - `limit: Optional[int]` Maximum number of time buckets/intervals to return. For responses with multiple series, this limit is applied to each series individually rather than accumulating across series. This is a limit of returned *interval sections*, it is **not** a limit of returned *points*. In other words, `limit=200` will provide 200 time points for a single series. For multi-series responses, each series will also see the exact same set of 200 time points. - `offset: Optional[int]` Time series bucket offset ### Returns - `class LendGetRateHistoryResponse: …` - `data: AssetRateHistory` Historical rates for assets - `pagination: Pagination` Values used for paginating the time series data - `interval_count: int` The total number of intervals/buckets for the provided interval parameters (size, period, start, end) - `next_offset: Optional[int]` The offset a client should use to fetch the next page of intervals (so long as limit remains unchanged) - `range: Range` Provides values for the requested range in it's entire width, regardless of page/limit. - `end: datetime` - `interval: Interval` Interval period & size - `unit: IntervalUnit` - `"h"` - `"d"` - `"w"` - `"m"` - `"y"` - `value: int` - `start: datetime` - `series: List[Series]` - `asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `id: str` - `group: Literal["native", "token"]` - `"native"` - `"token"` - `group_key: str` - `points: List[SeriesPoint]` - `t: datetime` - `v: Optional[str]` - `error: None` Error data. Guaranteed `null` for successful response. - `status: int` HTTP status. Successful responses are guaranteed to be < `400`. Conversely, error responses are guaranteed to be >= `400`. - `status_text: str` HTTP status text ### Example ```python from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() response = client.markets.lend.get_rate_history( end=0, period="h", start=0, ) print(response.data) ``` #### Response ```json { "data": { "range": { "start": 1775173209, "end": 1775778009, "interval": { "value": 1, "unit": "d" } }, "series": [ { "asset": { "id": "native;inj", "group": "native", "group_key": "inj" }, "points": [ { "t": 1775173209, "v": "0.1" }, { "t": 1775259609, "v": "0.1" }, { "t": 1775346009, "v": "0.1" }, { "t": 1775432409, "v": "0.1" }, { "t": 1775518809, "v": "0.1" }, { "t": 1775605209, "v": "0.1" }, { "t": 1775691609, "v": "0.1" }, { "t": 1775778009, "v": "0.1" } ] } ], "pagination": { "next_offset": 200, "interval_count": 221 } }, "error": null, "status": 200, "status_text": "200 OK" } ``` ## Domain Types ### Lend Market - `class LendMarket: …` Lending market overview - `asset_info: AssetInfo` Asset identifiers with associated metadata - `asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `id: str` - `group: Literal["native", "token"]` - `"native"` - `"token"` - `group_key: str` - `classification: AssetClassification` The asset's classification metadata. Assets are classfied to provide context on their usage throughout the Neptune API (e.g. regular assets, neptune receipt tokens, LSTs, etc.) Each asset belongs to only a single classification type. This object contains metadata pertaining to the given classification. While some fields may be common among the distinct classifcations, each classification is distinct and subject to independent change. - `class Regular: …` - `kind: Literal["regular"]` - `"regular"` - `neptune_receipt_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class NeptuneReceiptToken: …` - `kind: Literal["neptune_receipt_token"]` - `"neptune_receipt_token"` - `origin_asset: AssetSpec` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `class LiquidStakingToken: …` - `kind: Literal["liquid_staking_token"]` - `"liquid_staking_token"` - `origin_asset: Optional[AssetSpec]` Provides a unique identifier for an asset for use throughout the Neptune API. IDs are unique across asset domains (contract tokens, native denoms, etc) - `metadata: AssetMetadata` Additional metadata for assets - `decimals_denom: int` Denom exponent, or num. of decimal places that shift between denom/standard amounts (e.g. `18` for `INJ`) - `decimals_display: int` Number of decimals used when displaying amounts of this asset (this is subjective and used for generating text representations) - `name: str` Full name of the asset - `symbol: str` Symbol of the asset, e.g.: `NEPT` `INJ` - `symbol_denom: str` Denom symbol for the asset (e.g. `inj` for `INJ`, `sat` for `BTC`) - `rate: MarketRate` Lending market rates - `apr: str` Market rate in APR standard as a decimal percentage - `apy: str` Market rate in APY standard as a decimal percentage - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `apr: str` - `apy: str` - `state: LendMarketState` Current lending market state - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal_sum: str` - `receipt_total_supply: str` - `redemption_ratio: str` - `value: Optional[ExtraValue]` USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. ### Note This variant group contains an additional `price` field (set to the number used in value calculation). The embedded text group will contain the text variant if `with_text` was specified as well. - `extra: ExtraValueExtra` - `text: Optional[ExtraValueExtraText]` Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. - `price: str` Text representation of price - `principal_sum: str` - `price: str` Price used in value calculations - `principal_sum: str` - `principal_sum: str` The total amount of the asset deposited for lending in the market. - `receipt_total_supply: str` - `redemption_ratio: str` ### Lend Market Data - `class LendMarketData: …` - `rate: MarketRate` Lending market rates - `apr: str` Market rate in APR standard as a decimal percentage - `apy: str` Market rate in APY standard as a decimal percentage - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `apr: str` - `apy: str` - `state: LendMarketState` Current lending market state - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal_sum: str` - `receipt_total_supply: str` - `redemption_ratio: str` - `value: Optional[ExtraValue]` USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. ### Note This variant group contains an additional `price` field (set to the number used in value calculation). The embedded text group will contain the text variant if `with_text` was specified as well. - `extra: ExtraValueExtra` - `text: Optional[ExtraValueExtraText]` Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. - `price: str` Text representation of price - `principal_sum: str` - `price: str` Price used in value calculations - `principal_sum: str` - `principal_sum: str` The total amount of the asset deposited for lending in the market. - `receipt_total_supply: str` - `redemption_ratio: str` ### Lend Market State - `class LendMarketState: …` - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal_sum: str` - `receipt_total_supply: str` - `redemption_ratio: str` - `value: Optional[ExtraValue]` USD values for the corresponding amounts above. Will not be null when query param `with_value` is `true`. ### Note This variant group contains an additional `price` field (set to the number used in value calculation). The embedded text group will contain the text variant if `with_text` was specified as well. - `extra: ExtraValueExtra` - `text: Optional[ExtraValueExtraText]` Human-readable variants of USD values. Will not be null when query params `with_text` and `with_value` are `true`. - `price: str` Text representation of price - `principal_sum: str` - `price: str` Price used in value calculations - `principal_sum: str` - `principal_sum: str` The total amount of the asset deposited for lending in the market. - `receipt_total_supply: str` - `redemption_ratio: str`