From 9e71b8b2f76b4c84bd08ac74bef391a67c5270f1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 21:42:06 +0000 Subject: [PATCH 1/2] feat(api): rename `/markets/tvl` endpoint, fix market state pool fields, nest market listings under `content` --- .stats.yml | 6 +- api.md | 2 - .../resources/markets/borrow/collaterals.py | 4 +- .../resources/markets/borrow/debts.py | 4 +- .../resources/markets/markets.py | 88 -------- src/neptune_api_v2/types/__init__.py | 2 - .../types/market_get_overview_response.py | 53 ++++- .../types/market_get_tvl_params.py | 12 -- .../types/market_get_tvl_response.py | 23 --- .../markets/borrow/borrow_collateral_state.py | 16 +- .../types/markets/borrow/borrow_debt_state.py | 16 +- .../borrow/collateral_list_response.py | 145 ++++++++++++- .../markets/borrow/debt_list_response.py | 51 ++++- .../types/markets/borrow_market_overview.py | 190 +++++++++++++++++- .../markets/lend_get_by_asset_response.py | 2 +- .../types/markets/lend_list_response.py | 46 ++++- .../types/markets/lend_market.py | 2 +- .../types/markets/lend_market_state.py | 8 +- src/neptune_api_v2/types/tvl.py | 20 +- .../borrow/user_collateral_account_pool.py | 24 ++- .../borrow/user_collateral_asset_pool.py | 24 ++- tests/api_resources/test_markets.py | 73 ------- 22 files changed, 527 insertions(+), 284 deletions(-) delete mode 100644 src/neptune_api_v2/types/market_get_tvl_params.py delete mode 100644 src/neptune_api_v2/types/market_get_tvl_response.py diff --git a/.stats.yml b/.stats.yml index 03d410d..01f7b9a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-40d8045cda417d4c8a7a4a0d014345cdeb273fb5fdfa48eea08493bc5a5079ce.yml -openapi_spec_hash: 71ca66dcf6e775aae3f49b42cd6ce2cc +configured_endpoints: 49 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cryptech%2Fneptune-api-v2-05e0ec4b9b945a8c8e3542d34f0759f4eed2046a37750700fd40619f8a0cd6d7.yml +openapi_spec_hash: 3911018927f898449898cc6cc5685273 config_hash: f5ca3bc259f95069f0db4114d34e29ef diff --git a/api.md b/api.md index 42ec630..43d3bea 100644 --- a/api.md +++ b/api.md @@ -68,7 +68,6 @@ from neptune_api_v2.types import ( MarketGetMergedByAssetResponse, MarketGetOverviewResponse, MarketGetParamsResponse, - MarketGetTvlResponse, ) ``` @@ -78,7 +77,6 @@ Methods: - client.markets.get_merged_by_asset(\*\*params) -> MarketGetMergedByAssetResponse - client.markets.get_overview(\*\*params) -> MarketGetOverviewResponse - client.markets.get_params(\*\*params) -> MarketGetParamsResponse -- client.markets.get_tvl(\*\*params) -> MarketGetTvlResponse ## Lend diff --git a/src/neptune_api_v2/resources/markets/borrow/collaterals.py b/src/neptune_api_v2/resources/markets/borrow/collaterals.py index 2ef430b..b2e3671 100644 --- a/src/neptune_api_v2/resources/markets/borrow/collaterals.py +++ b/src/neptune_api_v2/resources/markets/borrow/collaterals.py @@ -55,7 +55,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CollateralListResponse: """ - Get borrowing collateral markets + Get borrowing collateral markets overview Args: with_text: Include text variation fields @@ -172,7 +172,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CollateralListResponse: """ - Get borrowing collateral markets + Get borrowing collateral markets overview Args: with_text: Include text variation fields diff --git a/src/neptune_api_v2/resources/markets/borrow/debts.py b/src/neptune_api_v2/resources/markets/borrow/debts.py index c9602ae..103c067 100644 --- a/src/neptune_api_v2/resources/markets/borrow/debts.py +++ b/src/neptune_api_v2/resources/markets/borrow/debts.py @@ -55,7 +55,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DebtListResponse: """ - Get borrowing debt markets + Get borrowing debt markets overview Args: with_text: Include text variation fields @@ -172,7 +172,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DebtListResponse: """ - Get borrowing debt markets + Get borrowing debt markets overview Args: with_text: Include text variation fields diff --git a/src/neptune_api_v2/resources/markets/markets.py b/src/neptune_api_v2/resources/markets/markets.py index e5320fc..95d3787 100644 --- a/src/neptune_api_v2/resources/markets/markets.py +++ b/src/neptune_api_v2/resources/markets/markets.py @@ -13,7 +13,6 @@ AsyncLendResourceWithStreamingResponse, ) from ...types import ( - market_get_tvl_params, market_get_merged_params, market_get_params_params, market_get_overview_params, @@ -38,7 +37,6 @@ AsyncBorrowResourceWithStreamingResponse, ) from ..._base_client import make_request_options -from ...types.market_get_tvl_response import MarketGetTvlResponse from ...types.market_get_merged_response import MarketGetMergedResponse from ...types.market_get_params_response import MarketGetParamsResponse from ...types.market_get_overview_response import MarketGetOverviewResponse @@ -254,43 +252,6 @@ def get_params( cast_to=MarketGetParamsResponse, ) - def get_tvl( - self, - *, - with_text: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> MarketGetTvlResponse: - """ - Get market TVL - - Args: - with_text: Include text variation fields - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/api/v1/markets/tvl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"with_text": with_text}, market_get_tvl_params.MarketGetTvlParams), - ), - cast_to=MarketGetTvlResponse, - ) - class AsyncMarketsResource(AsyncAPIResource): @cached_property @@ -501,43 +462,6 @@ async def get_params( cast_to=MarketGetParamsResponse, ) - async def get_tvl( - self, - *, - with_text: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> MarketGetTvlResponse: - """ - Get market TVL - - Args: - with_text: Include text variation fields - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/api/v1/markets/tvl", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"with_text": with_text}, market_get_tvl_params.MarketGetTvlParams), - ), - cast_to=MarketGetTvlResponse, - ) - class MarketsResourceWithRawResponse: def __init__(self, markets: MarketsResource) -> None: @@ -555,9 +479,6 @@ def __init__(self, markets: MarketsResource) -> None: self.get_params = to_raw_response_wrapper( markets.get_params, ) - self.get_tvl = to_raw_response_wrapper( - markets.get_tvl, - ) @cached_property def lend(self) -> LendResourceWithRawResponse: @@ -584,9 +505,6 @@ def __init__(self, markets: AsyncMarketsResource) -> None: self.get_params = async_to_raw_response_wrapper( markets.get_params, ) - self.get_tvl = async_to_raw_response_wrapper( - markets.get_tvl, - ) @cached_property def lend(self) -> AsyncLendResourceWithRawResponse: @@ -613,9 +531,6 @@ def __init__(self, markets: MarketsResource) -> None: self.get_params = to_streamed_response_wrapper( markets.get_params, ) - self.get_tvl = to_streamed_response_wrapper( - markets.get_tvl, - ) @cached_property def lend(self) -> LendResourceWithStreamingResponse: @@ -642,9 +557,6 @@ def __init__(self, markets: AsyncMarketsResource) -> None: self.get_params = async_to_streamed_response_wrapper( markets.get_params, ) - self.get_tvl = async_to_streamed_response_wrapper( - markets.get_tvl, - ) @cached_property def lend(self) -> AsyncLendResourceWithStreamingResponse: diff --git a/src/neptune_api_v2/types/__init__.py b/src/neptune_api_v2/types/__init__.py index 98dbf87..c9c2909 100644 --- a/src/neptune_api_v2/types/__init__.py +++ b/src/neptune_api_v2/types/__init__.py @@ -27,11 +27,9 @@ from .asset_classification import AssetClassification as AssetClassification from .global_market_config import GlobalMarketConfig as GlobalMarketConfig from .user_get_user_params import UserGetUserParams as UserGetUserParams -from .market_get_tvl_params import MarketGetTvlParams as MarketGetTvlParams from .nept_get_state_params import NeptGetStateParams as NeptGetStateParams from .nept_get_params_params import NeptGetParamsParams as NeptGetParamsParams from .user_get_user_response import UserGetUserResponse as UserGetUserResponse -from .market_get_tvl_response import MarketGetTvlResponse as MarketGetTvlResponse from .nept_get_state_response import NeptGetStateResponse as NeptGetStateResponse from .validation_field_source import ValidationFieldSource as ValidationFieldSource from .asset_list_prices_params import AssetListPricesParams as AssetListPricesParams diff --git a/src/neptune_api_v2/types/market_get_overview_response.py b/src/neptune_api_v2/types/market_get_overview_response.py index b54bfba..9531826 100644 --- a/src/neptune_api_v2/types/market_get_overview_response.py +++ b/src/neptune_api_v2/types/market_get_overview_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from .tvl import Tvl from .._models import BaseModel @@ -8,7 +8,50 @@ from .global_market_config import GlobalMarketConfig from .markets.borrow_market_overview import BorrowMarketOverview -__all__ = ["MarketGetOverviewResponse", "Data"] +__all__ = [ + "MarketGetOverviewResponse", + "Data", + "DataLend", + "DataLendSupply", + "DataLendSupplyExtra", + "DataLendSupplyExtraText", +] + + +class DataLendSupplyExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + principal: str + + +class DataLendSupplyExtra(BaseModel): + text: Optional[DataLendSupplyExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DataLendSupply(BaseModel): + """Supply breakdown for lending markets""" + + extra: DataLendSupplyExtra + + principal: str + """Sum USD value of lending principal""" + + +class DataLend(BaseModel): + """Lending markets overview""" + + contents: List[LendMarket] + """Lending markets""" + + supply: DataLendSupply + """Supply breakdown for lending markets""" class Data(BaseModel): @@ -18,11 +61,11 @@ class Data(BaseModel): global_config: GlobalMarketConfig """Market runtime parameters""" - lend: List[LendMarket] - """Current lending markets""" + lend: DataLend + """Lending markets overview""" tvl: Tvl - """Market TVL""" + """Oveerall market TVL""" class MarketGetOverviewResponse(BaseModel): diff --git a/src/neptune_api_v2/types/market_get_tvl_params.py b/src/neptune_api_v2/types/market_get_tvl_params.py deleted file mode 100644 index 52186ab..0000000 --- a/src/neptune_api_v2/types/market_get_tvl_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["MarketGetTvlParams"] - - -class MarketGetTvlParams(TypedDict, total=False): - with_text: bool - """Include text variation fields""" diff --git a/src/neptune_api_v2/types/market_get_tvl_response.py b/src/neptune_api_v2/types/market_get_tvl_response.py deleted file mode 100644 index c409ed2..0000000 --- a/src/neptune_api_v2/types/market_get_tvl_response.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .tvl import Tvl -from .._models import BaseModel - -__all__ = ["MarketGetTvlResponse"] - - -class MarketGetTvlResponse(BaseModel): - data: Tvl - - error: None = 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""" diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py index 6797d88..1989e60 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_collateral_state.py @@ -15,7 +15,7 @@ class ExtraText(BaseModel): balance: str - collateral_sum: str + shares: str class ExtraValueExtraText(BaseModel): @@ -26,11 +26,11 @@ class ExtraValueExtraText(BaseModel): balance: str - collateral_sum: str - price: str """Text representation of price""" + shares: str + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -54,13 +54,13 @@ class ExtraValue(BaseModel): balance: str - collateral_sum: str - extra: ExtraValueExtra price: str """Price used in value calculations""" + shares: str + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -87,7 +87,7 @@ class Extra(BaseModel): class BorrowCollateralState(BaseModel): balance: str - collateral_sum: str - """Total amount of this asset which is actively collateralized""" - extra: Extra + + shares: str + """Total amount of this asset which is actively collateralized""" diff --git a/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py b/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py index 0beda87..2890a45 100644 --- a/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py +++ b/src/neptune_api_v2/types/markets/borrow/borrow_debt_state.py @@ -14,9 +14,9 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - balance_sum: str + balance: str - principal_sum: str + shares: str time_last_distributed_interest: str @@ -27,12 +27,12 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - balance_sum: str + balance: str price: str """Text representation of price""" - principal_sum: str + shares: str class ExtraValueExtra(BaseModel): @@ -55,14 +55,14 @@ class ExtraValue(BaseModel): The embedded text group will contain the text variant if `with_text` was specified as well. """ - balance_sum: str + balance: str extra: ExtraValueExtra price: str """Price used in value calculations""" - principal_sum: str + shares: str class Extra(BaseModel): @@ -88,11 +88,11 @@ class Extra(BaseModel): class BorrowDebtState(BaseModel): - balance_sum: str + balance: str extra: Extra - principal_sum: str + shares: str time_last_distributed_interest: datetime """Timestamp used to keep track of the last time interest was distributed.""" diff --git a/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py b/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py index 1a0e9be..5a8afc5 100644 --- a/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py +++ b/src/neptune_api_v2/types/markets/borrow/collateral_list_response.py @@ -1,18 +1,151 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from ...._models import BaseModel from .borrow_collateral_market import BorrowCollateralMarket -__all__ = ["CollateralListResponse"] +__all__ = [ + "CollateralListResponse", + "Data", + "DataSupply", + "DataSupplyNonReceipt", + "DataSupplyNonReceiptExtra", + "DataSupplyNonReceiptExtraText", + "DataSupplyReceipt", + "DataSupplyReceiptExtra", + "DataSupplyReceiptExtraText", + "DataSupplyTotal", + "DataSupplyTotalExtra", + "DataSupplyTotalExtraText", +] -class CollateralListResponse(BaseModel): - count: int - """Total number of objects irrespective of any pagination parameters.""" +class DataSupplyNonReceiptExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class DataSupplyNonReceiptExtra(BaseModel): + text: Optional[DataSupplyNonReceiptExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DataSupplyNonReceipt(BaseModel): + """Supply of all collaterals (excluding receipt tokens)""" + + balance: str + """Sum USD value of market balance""" + + extra: DataSupplyNonReceiptExtra + + shares: str + """Sum USD value of market shares""" + + +class DataSupplyReceiptExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class DataSupplyReceiptExtra(BaseModel): + text: Optional[DataSupplyReceiptExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DataSupplyReceipt(BaseModel): + """Supply of receipt token collaterals""" + + balance: str + """Sum USD value of market balance""" + + extra: DataSupplyReceiptExtra + + shares: str + """Sum USD value of market shares""" + - data: List[BorrowCollateralMarket] +class DataSupplyTotalExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class DataSupplyTotalExtra(BaseModel): + text: Optional[DataSupplyTotalExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DataSupplyTotal(BaseModel): + """Total supply for collaterals, regardless of type. + + Equivalent to `non_receipt + receipt` + """ + + balance: str + """Sum USD value of market balance""" + + extra: DataSupplyTotalExtra + + shares: str + """Sum USD value of market shares""" + + +class DataSupply(BaseModel): + """Supply breakdown for collaterals""" + + non_receipt: DataSupplyNonReceipt + """Supply of all collaterals (excluding receipt tokens)""" + + receipt: DataSupplyReceipt + """Supply of receipt token collaterals""" + + total: DataSupplyTotal + """Total supply for collaterals, regardless of type. + + Equivalent to `non_receipt + receipt` + """ + + +class Data(BaseModel): + """Borrowing market collaterals overview""" + + contents: List[BorrowCollateralMarket] + """Borrowing collateral markets""" + + supply: DataSupply + """Supply breakdown for collaterals""" + + +class CollateralListResponse(BaseModel): + data: Data + """Borrowing market collaterals overview""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/borrow/debt_list_response.py b/src/neptune_api_v2/types/markets/borrow/debt_list_response.py index 080479d..0ba0ba5 100644 --- a/src/neptune_api_v2/types/markets/borrow/debt_list_response.py +++ b/src/neptune_api_v2/types/markets/borrow/debt_list_response.py @@ -1,18 +1,57 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from ...._models import BaseModel from .borrow_debt_market import BorrowDebtMarket -__all__ = ["DebtListResponse"] +__all__ = ["DebtListResponse", "Data", "DataSupply", "DataSupplyExtra", "DataSupplyExtraText"] -class DebtListResponse(BaseModel): - count: int - """Total number of objects irrespective of any pagination parameters.""" +class DataSupplyExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class DataSupplyExtra(BaseModel): + text: Optional[DataSupplyExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + - data: List[BorrowDebtMarket] +class DataSupply(BaseModel): + """Supply breakdown for debt markets""" + + balance: str + """Sum USD value of market balance""" + + extra: DataSupplyExtra + + shares: str + """Sum USD value of market shares""" + + +class Data(BaseModel): + """Borrowing market debts overview""" + + contents: List[BorrowDebtMarket] + """Borrowing debt markets""" + + supply: DataSupply + """Supply breakdown for debt markets""" + + +class DebtListResponse(BaseModel): + data: Data + """Borrowing market debts overview""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/borrow_market_overview.py b/src/neptune_api_v2/types/markets/borrow_market_overview.py index 3f632c7..16131a6 100644 --- a/src/neptune_api_v2/types/markets/borrow_market_overview.py +++ b/src/neptune_api_v2/types/markets/borrow_market_overview.py @@ -1,17 +1,197 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from ..._models import BaseModel from .borrow.borrow_debt_market import BorrowDebtMarket from .borrow.borrow_collateral_market import BorrowCollateralMarket -__all__ = ["BorrowMarketOverview"] +__all__ = [ + "BorrowMarketOverview", + "Collaterals", + "CollateralsSupply", + "CollateralsSupplyNonReceipt", + "CollateralsSupplyNonReceiptExtra", + "CollateralsSupplyNonReceiptExtraText", + "CollateralsSupplyReceipt", + "CollateralsSupplyReceiptExtra", + "CollateralsSupplyReceiptExtraText", + "CollateralsSupplyTotal", + "CollateralsSupplyTotalExtra", + "CollateralsSupplyTotalExtraText", + "Debts", + "DebtsSupply", + "DebtsSupplyExtra", + "DebtsSupplyExtraText", +] -class BorrowMarketOverview(BaseModel): - collaterals: List[BorrowCollateralMarket] +class CollateralsSupplyNonReceiptExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class CollateralsSupplyNonReceiptExtra(BaseModel): + text: Optional[CollateralsSupplyNonReceiptExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class CollateralsSupplyNonReceipt(BaseModel): + """Supply of all collaterals (excluding receipt tokens)""" + + balance: str + """Sum USD value of market balance""" + + extra: CollateralsSupplyNonReceiptExtra + + shares: str + """Sum USD value of market shares""" + + +class CollateralsSupplyReceiptExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class CollateralsSupplyReceiptExtra(BaseModel): + text: Optional[CollateralsSupplyReceiptExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class CollateralsSupplyReceipt(BaseModel): + """Supply of receipt token collaterals""" + + balance: str + """Sum USD value of market balance""" + + extra: CollateralsSupplyReceiptExtra + + shares: str + """Sum USD value of market shares""" + + +class CollateralsSupplyTotalExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class CollateralsSupplyTotalExtra(BaseModel): + text: Optional[CollateralsSupplyTotalExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class CollateralsSupplyTotal(BaseModel): + """Total supply for collaterals, regardless of type. + + Equivalent to `non_receipt + receipt` + """ + + balance: str + """Sum USD value of market balance""" + + extra: CollateralsSupplyTotalExtra + + shares: str + """Sum USD value of market shares""" + + +class CollateralsSupply(BaseModel): + """Supply breakdown for collaterals""" + + non_receipt: CollateralsSupplyNonReceipt + """Supply of all collaterals (excluding receipt tokens)""" + + receipt: CollateralsSupplyReceipt + """Supply of receipt token collaterals""" + + total: CollateralsSupplyTotal + """Total supply for collaterals, regardless of type. + + Equivalent to `non_receipt + receipt` + """ + + +class Collaterals(BaseModel): + """Borrowing market collaterals overview""" + + contents: List[BorrowCollateralMarket] """Borrowing collateral markets""" - debts: List[BorrowDebtMarket] + supply: CollateralsSupply + """Supply breakdown for collaterals""" + + +class DebtsSupplyExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + balance: str + + shares: str + + +class DebtsSupplyExtra(BaseModel): + text: Optional[DebtsSupplyExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + +class DebtsSupply(BaseModel): + """Supply breakdown for debt markets""" + + balance: str + """Sum USD value of market balance""" + + extra: DebtsSupplyExtra + + shares: str + """Sum USD value of market shares""" + + +class Debts(BaseModel): + """Borrowing market debts overview""" + + contents: List[BorrowDebtMarket] """Borrowing debt markets""" + + supply: DebtsSupply + """Supply breakdown for debt markets""" + + +class BorrowMarketOverview(BaseModel): + collaterals: Collaterals + """Borrowing market collaterals overview""" + + debts: Debts + """Borrowing market debts overview""" diff --git a/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py b/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py index 6f99e48..f8aeed0 100644 --- a/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py +++ b/src/neptune_api_v2/types/markets/lend_get_by_asset_response.py @@ -8,7 +8,7 @@ class LendGetByAssetResponse(BaseModel): data: LendMarket - """Lending market overview""" + """Lending market""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/lend_list_response.py b/src/neptune_api_v2/types/markets/lend_list_response.py index 4d013b0..a5612ec 100644 --- a/src/neptune_api_v2/types/markets/lend_list_response.py +++ b/src/neptune_api_v2/types/markets/lend_list_response.py @@ -1,18 +1,52 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from ..._models import BaseModel from .lend_market import LendMarket -__all__ = ["LendListResponse"] +__all__ = ["LendListResponse", "Data", "DataSupply", "DataSupplyExtra", "DataSupplyExtraText"] -class LendListResponse(BaseModel): - count: int - """Total number of objects irrespective of any pagination parameters.""" +class DataSupplyExtraText(BaseModel): + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + + principal: str + + +class DataSupplyExtra(BaseModel): + text: Optional[DataSupplyExtraText] = None + """Human-readable field variants. + + Will not be null when query param `with_text` is `true`. + """ + - data: List[LendMarket] +class DataSupply(BaseModel): + """Supply breakdown for lending markets""" + + extra: DataSupplyExtra + + principal: str + """Sum USD value of lending principal""" + + +class Data(BaseModel): + """Lending markets overview""" + + contents: List[LendMarket] + """Lending markets""" + + supply: DataSupply + """Supply breakdown for lending markets""" + + +class LendListResponse(BaseModel): + data: Data + """Lending markets overview""" error: None = None """Error data. Guaranteed `null` for successful response.""" diff --git a/src/neptune_api_v2/types/markets/lend_market.py b/src/neptune_api_v2/types/markets/lend_market.py index b35de99..31b4cf2 100644 --- a/src/neptune_api_v2/types/markets/lend_market.py +++ b/src/neptune_api_v2/types/markets/lend_market.py @@ -9,7 +9,7 @@ class LendMarket(BaseModel): - """Lending market overview""" + """Lending market""" asset_info: AssetInfo """Asset identifiers with associated metadata""" diff --git a/src/neptune_api_v2/types/markets/lend_market_state.py b/src/neptune_api_v2/types/markets/lend_market_state.py index ca69ef7..11f1c80 100644 --- a/src/neptune_api_v2/types/markets/lend_market_state.py +++ b/src/neptune_api_v2/types/markets/lend_market_state.py @@ -13,7 +13,7 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - principal_sum: str + principal: str receipt_total_supply: str @@ -29,7 +29,7 @@ class ExtraValueExtraText(BaseModel): price: str """Text representation of price""" - principal_sum: str + principal: str class ExtraValueExtra(BaseModel): @@ -57,7 +57,7 @@ class ExtraValue(BaseModel): price: str """Price used in value calculations""" - principal_sum: str + principal: str class Extra(BaseModel): @@ -85,7 +85,7 @@ class Extra(BaseModel): class LendMarketState(BaseModel): extra: Extra - principal_sum: str + principal: str """The total amount of the asset deposited for lending in the market.""" receipt_total_supply: str diff --git a/src/neptune_api_v2/types/tvl.py b/src/neptune_api_v2/types/tvl.py index 0e6aeaf..9d26004 100644 --- a/src/neptune_api_v2/types/tvl.py +++ b/src/neptune_api_v2/types/tvl.py @@ -13,11 +13,9 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - collateral_value: str + net_tvl: str - lend_value: str - - total_value: str + tvl: str class Extra(BaseModel): @@ -29,13 +27,13 @@ class Extra(BaseModel): class Tvl(BaseModel): - collateral_value: str - """Market TVL in USD - collateral portion""" - extra: Extra - lend_value: str - """Market TVL in USD - lend portion""" + net_tvl: str + """Market net TVL in USD (equivalent to `tvl - borrow.debts.supply.balance`)""" - total_value: str - """Market TVL in USD""" + tvl: str + """ + Market TVL in USD (equivalent to + `borrow.collaterals.supply.non_receipt.balance + lend.supply.principal`) + """ diff --git a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py index f34e6b4..e7258e6 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_collateral_account_pool.py @@ -13,7 +13,9 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - amount: str + principal: str + + shares: str class ExtraValueExtraText(BaseModel): @@ -22,11 +24,13 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - amount: str - price: str """Text representation of price""" + principal: str + + shares: str + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -48,13 +52,15 @@ class ExtraValue(BaseModel): The embedded text group will contain the text variant if `with_text` was specified as well. """ - amount: str - extra: ExtraValueExtra price: str """Price used in value calculations""" + principal: str + + shares: str + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -86,10 +92,12 @@ class UserCollateralAccountPool(BaseModel): Typically used in contexts where multiple subaccounts with a shared underlying asset are batched together. """ - amount: str - """Amount of this asset which is actively collateralized""" - extra: Extra index: int """Account index""" + + principal: str + """Amount of this asset which is actively collateralized""" + + shares: str diff --git a/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py b/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py index 58a54db..f135bdb 100644 --- a/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py +++ b/src/neptune_api_v2/types/user/market/borrow/user_collateral_asset_pool.py @@ -14,7 +14,9 @@ class ExtraText(BaseModel): Will not be null when query param `with_text` is `true`. """ - amount: str + principal: str + + shares: str class ExtraValueExtraText(BaseModel): @@ -23,11 +25,13 @@ class ExtraValueExtraText(BaseModel): Will not be null when query params `with_text` and `with_value` are `true`. """ - amount: str - price: str """Text representation of price""" + principal: str + + shares: str + class ExtraValueExtra(BaseModel): text: Optional[ExtraValueExtraText] = None @@ -49,13 +53,15 @@ class ExtraValue(BaseModel): The embedded text group will contain the text variant if `with_text` was specified as well. """ - amount: str - extra: ExtraValueExtra price: str """Price used in value calculations""" + principal: str + + shares: str + class Extra(BaseModel): text: Optional[ExtraText] = None @@ -80,10 +86,12 @@ class Extra(BaseModel): class UserCollateralAssetPool(BaseModel): - amount: str - """Amount of this asset which is actively collateralized""" - asset_info: AssetInfo """Asset identifiers with associated metadata""" extra: Extra + + principal: str + """Amount of this asset which is actively collateralized""" + + shares: str diff --git a/tests/api_resources/test_markets.py b/tests/api_resources/test_markets.py index 4574adc..0a5f4cf 100644 --- a/tests/api_resources/test_markets.py +++ b/tests/api_resources/test_markets.py @@ -10,7 +10,6 @@ from tests.utils import assert_matches_type from neptune_api_v2 import NeptuneAPIV2, AsyncNeptuneAPIV2 from neptune_api_v2.types import ( - MarketGetTvlResponse, MarketGetMergedResponse, MarketGetParamsResponse, MarketGetOverviewResponse, @@ -177,42 +176,6 @@ def test_streaming_response_get_params(self, client: NeptuneAPIV2) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_tvl(self, client: NeptuneAPIV2) -> None: - market = client.markets.get_tvl() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_get_tvl_with_all_params(self, client: NeptuneAPIV2) -> None: - market = client.markets.get_tvl( - with_text=True, - ) - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_get_tvl(self, client: NeptuneAPIV2) -> None: - response = client.markets.with_raw_response.get_tvl() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - market = response.parse() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_get_tvl(self, client: NeptuneAPIV2) -> None: - with client.markets.with_streaming_response.get_tvl() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - market = response.parse() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncMarkets: parametrize = pytest.mark.parametrize( @@ -372,39 +335,3 @@ async def test_streaming_response_get_params(self, async_client: AsyncNeptuneAPI assert_matches_type(MarketGetParamsResponse, market, path=["response"]) assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_tvl(self, async_client: AsyncNeptuneAPIV2) -> None: - market = await async_client.markets.get_tvl() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_get_tvl_with_all_params(self, async_client: AsyncNeptuneAPIV2) -> None: - market = await async_client.markets.get_tvl( - with_text=True, - ) - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_get_tvl(self, async_client: AsyncNeptuneAPIV2) -> None: - response = await async_client.markets.with_raw_response.get_tvl() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - market = await response.parse() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_get_tvl(self, async_client: AsyncNeptuneAPIV2) -> None: - async with async_client.markets.with_streaming_response.get_tvl() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - market = await response.parse() - assert_matches_type(MarketGetTvlResponse, market, path=["response"]) - - assert cast(Any, response.is_closed) is True From 27a870e22ef08c97b0bb2cb874e4786ac40e63d6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 21:42:23 +0000 Subject: [PATCH 2/2] release: 0.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/neptune_api_v2/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2aca35a..4208b5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0" + ".": "0.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 455acfa..c5df7fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.6.0 (2026-04-17) + +Full Changelog: [v0.5.0...v0.6.0](https://github.com/cryptechdev/neptune-api-v2-python/compare/v0.5.0...v0.6.0) + +### Features + +* **api:** rename `/markets/tvl` endpoint, fix market state pool fields, nest market listings under `content` ([9e71b8b](https://github.com/cryptechdev/neptune-api-v2-python/commit/9e71b8b2f76b4c84bd08ac74bef391a67c5270f1)) + ## 0.5.0 (2026-04-17) Full Changelog: [v0.4.0...v0.5.0](https://github.com/cryptechdev/neptune-api-v2-python/compare/v0.4.0...v0.5.0) diff --git a/pyproject.toml b/pyproject.toml index 09e2885..69e2350 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "neptune_api_v2" -version = "0.5.0" +version = "0.6.0" description = "The official Python library for the neptune-api-v2 API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/neptune_api_v2/_version.py b/src/neptune_api_v2/_version.py index 8269137..8f4a369 100644 --- a/src/neptune_api_v2/_version.py +++ b/src/neptune_api_v2/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "neptune_api_v2" -__version__ = "0.5.0" # x-release-please-version +__version__ = "0.6.0" # x-release-please-version