## Get user markets for all kinds (lend + borrow debt/collateral), grouped together by asset `user.market.get_merged(straddress, MarketGetMergedParams**kwargs) -> MarketGetMergedResponse` **get** `/api/v1/users/{address}/markets/merged` Get user markets for all kinds (lend + borrow debt/collateral), grouped together by asset ### Parameters - `address: str` The user account address - `with_text: Optional[bool]` Include text variation fields - `with_value: Optional[bool]` Calculate and include USD values for amounts, where applicable ### Returns - `class MarketGetMergedResponse: …` - `count: int` Total number of objects irrespective of any pagination parameters. - `data: List[UserMergedMarket]` - `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`) - `borrow_collateral: List[UserCollateralAccountPool]` User collateral contribution for asset in borrow market, listed by subaccount - `amount: str` Amount of this asset which is actively collateralized - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `amount: 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. - `amount: str` - `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`. - `amount: str` - `price: str` Text representation of price - `price: str` Price used in value calculations - `index: int` Account index - `borrow_debt: List[UserDebtAccountPool]` User debt contribution for asset in borrow market, listed by subaccount - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `principal: str` - `shares: 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: str` - `shares: str` - `price: str` Price used in value calculations - `principal: str` - `shares: str` - `index: int` Account index - `principal: str` Initial amount borrowed (of debts which have not yet been repaid) - `shares: str` - `lend: Optional[Lend]` User contribution for asset's lending market, if one exists - `origin_equivalent: UserLendOriginAmounts` The lending amounts converted into the equivalent for the receipt token's origin/source asset - `collateralized: str` Total equivalent amount of origin token collateralized across this user's borrowing portfolio **NOTE:** This is **not** the amount of the origin asset that the user holds, but the amount held in the receipt token rendered as the equivalent amount in the origin asset. Or, more formally: `origin_equivalent_collateralized = receipt_collateralized / receipt_redemption_ratio` - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `collateralized: str` - `held: str` - `total: str` - `held: str` Total equivalent amount of origin token held in address balance **NOTE:** This is **not** the amount of the origin asset that the user holds, but the amount held in the receipt token rendered as the equivalent amount in the origin asset. Or, more formally: `origin_equivalent_held = receipt_held / receipt_redemption_ratio` - `total: str` Total of held and collateralized equivalent for origin asset Or, more formally: `origin_equivalent_total = receipt_lent_total / receipt_redemption_ratio` - `receipt_amounts: UserLendReceiptAmounts` The lending amounts in the original receipt token amounts - `collateralized: str` Total amount of receipt token collateralized across this user's borrowing portfolio - `extra: Extra` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `collateralized: str` - `held: str` - `total: 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. - `collateralized: str` - `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`. - `collateralized: str` - `held: str` - `price: str` Text representation of price - `total: str` - `held: str` - `price: str` Price used in value calculations - `total: str` - `held: str` Total amount of receipt token held in address balance - `total: str` Sum of receipt amount held and receipt amount collateralized - `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.user.market.get_merged( address="injvalcons1a03k0ztfyjnd70apawva003pkh0adqmau0a9q0", ) print(response.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" } } }, "lend": { "receipt_amounts": { "held": "118147367218417456837", "collateralized": "140264620447028478901", "total": "258411987665445935738", "extra": { "text": { "total": "258.4119 nINJ", "held": "118.1473 nINJ", "collateralized": "140.2646 nINJ" }, "value": { "held": "380.958434916458275153", "collateralized": "452.274067020608845929", "price": "3.224434398205298254", "total": "833.232501937067121083", "extra": { "text": { "price": "$3.22", "collateralized": "$452.27", "held": "$380.95", "total": "$833.23" } } } } }, "origin_equivalent": { "held": "126715646832648060567", "collateralized": "150436886797680767926", "total": "277152533630328828494", "extra": { "text": { "total": "277.1525 INJ", "collateralized": "150.4368 INJ", "held": "126.7156 INJ" } } } }, "borrow_collateral": [ { "index": 0, "amount": "149436500580266304744", "extra": { "text": { "amount": "149.4365 INJ" }, "value": { "price": "2.99835", "amount": "448.062931514841474829", "extra": { "text": { "amount": "$448.06", "price": "$2.99" } } } } } ], "borrow_debt": [ { "index": 0, "principal": "911081148730079455959", "shares": "911081148730079455959", "extra": { "text": { "principal": "911.0811 INJ", "shares": "911.0811 INJ" }, "value": { "shares": "2731.740162294833736774", "price": "2.99835", "principal": "2731.740162294833736774", "extra": { "text": { "shares": "$2,731.74", "price": "$2.99", "principal": "$2,731.74" } } } } } ] } ], "count": 1, "error": null, "status": 200, "status_text": "200 OK" } ```