# Market ## Get analytics for current market state `analytics.market.get_current_state() -> MarketGetCurrentStateResponse` **get** `/api/v1/analytics/market/state` Get analytics for current market state ### Returns - `class MarketGetCurrentStateResponse: …` - `data: Data` - `assets: List[DataAsset]` - `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` - `lend_interest_paid: str` - `borrower_account_active: int` - `borrower_active: int` - `flash_loan_volume_total: str` - `lender_active: int` - `loans_originated: DataLoansOriginated` Analytics for accumulated value of originated loans - `breakdown: List[DataLoansOriginatedBreakdown]` - `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) - `value: Union[str, float]` - `str` - `float` - `total_value: Union[str, float]` - `str` - `float` - `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.analytics.market.get_current_state() print(response.data) ``` #### Response ```json { "data": { "borrower_active": 1000, "borrower_account_active": 1200, "lender_active": 1300, "loans_originated": { "total_value": "8.04", "breakdown": [ { "asset": { "id": "native;inj", "group": "native", "group_key": "inj" }, "value": "8.04" } ] }, "flash_loan_volume_total": "13270.54", "assets": [ { "asset": { "id": "native;inj", "group": "native", "group_key": "inj" }, "lend_interest_paid": "1853.23" } ] }, "error": null, "status": 200, "status_text": "200 OK" } ``` # History ## Get cumulative lending value history independent of assets `analytics.market.history.get_loans_originated(HistoryGetLoansOriginatedParams**kwargs) -> SyncIntervalSinglePage[HistoryGetLoansOriginatedResponse]` **get** `/api/v1/analytics/market/history/loans-originated` Get cumulative lending value history independent of 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) - `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 HistoryGetLoansOriginatedResponse: …` Time + value pair representing a point in time for use with time series - `t: datetime` - `v: Union[str, float, null]` - `str` - `float` ### Example ```python from neptune_api_v2 import NeptuneAPIV2 client = NeptuneAPIV2() page = client.analytics.market.history.get_loans_originated( end=0, period="h", start=0, ) page = page.data.points[0] print(page.t) ``` #### Response ```json { "data": { "range": { "start": 1775173209, "end": 1775778009, "interval": { "value": 1, "unit": "d" } }, "points": [ { "t": 1775173209, "v": "0.100" }, { "t": 1775259609, "v": "0.100" }, { "t": 1775346009, "v": "0.100" }, { "t": 1775432409, "v": "0.100" }, { "t": 1775518809, "v": "0.100" }, { "t": 1775605209, "v": "0.100" }, { "t": 1775691609, "v": "0.100" }, { "t": 1775778009, "v": "0.100" } ], "pagination": { "next_offset": 200, "interval_count": 221 } }, "error": null, "status": 200, "status_text": "200 OK" } ``` ## Get loans originated history `analytics.market.history.get_loans_originated_by_asset(HistoryGetLoansOriginatedByAssetParams**kwargs) -> HistoryGetLoansOriginatedByAssetResponse` **get** `/api/v1/analytics/market/history/loans-originated/by-asset` Get loans originated history ### 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 HistoryGetLoansOriginatedByAssetResponse: …` - `data: Data` Historical cumulative lend value for assets - `pagination: DataPagination` 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: DataRange` 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[DataSeries]` - `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[DataSeriesPoint]` - `t: datetime` - `v: Union[str, float, null]` - `str` - `float` - `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.analytics.market.history.get_loans_originated_by_asset( 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.100" }, { "t": 1775259609, "v": "0.100" }, { "t": 1775346009, "v": "0.100" }, { "t": 1775432409, "v": "0.100" }, { "t": 1775518809, "v": "0.100" }, { "t": 1775605209, "v": "0.100" }, { "t": 1775691609, "v": "0.100" }, { "t": 1775778009, "v": "0.100" } ] } ], "pagination": { "next_offset": 200, "interval_count": 221 } }, "error": null, "status": 200, "status_text": "200 OK" } ```