# Analytics # 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" } ``` # Nept ## Get distribution analytics for NEPT unlocks `analytics.nept.unlocks_distribution(NeptUnlocksDistributionParams**kwargs) -> NeptUnlocksDistributionResponse` **get** `/api/v1/analytics/nept/unlocks-distribution` Get distribution analytics for NEPT unlocks ### Parameters - `with_percent: Optional[bool]` Calculate and include proportional percentages, where applicable - `with_text: Optional[bool]` Include text variation fields - `with_value: Optional[bool]` Calculate and include USD values for amounts, where applicable ### Returns - `class NeptUnlocksDistributionResponse: …` - `data: Data` - `groups: List[NeptUnlockDistributionGroup]` - `amount: str` The sum of all token distribution unlock amounts for this group. This value is immutable and does not change with regards to expiry/reclamation/lock states. - `amount_claimable: str` The amount currently claimable This takes into account: reclamation, lock state, expiry, and previously claimed. In other words, this is an accurate representation of what the user can currently claim. - `amount_claimed: str` The amount that has already been successfully claimed by the user - `amount_expired: str` The amount that has expired. This will be the remaining unclaimed amount (if any) once the time specified by the `expires_at` is past (if one is set). **NOTE:** Reclaimed amouts take priority. - If the remaining amount is reclaimed prior to a configured `expires_at`, this will remain at 0 and will not change even after the `expires_at` time is reached. - `amount_held: str` The total amount of NEPT currently held by the addresses in this group. - `amount_locked: str` The total amount of NEPT currently time-locked. **NOTE:** This does not factor in reclaimed or expired states. - For linear unlock schedules: - This represents how much NEPT is time-locked by the `begins_at` and the `ends_at` properties. - For lump sum unlocks: - This will be the full amount prior to the `begins_at` unlock property. - Once the time indicated by the `begins_at` property has been reached, this value will be 0. - `amount_reclaimed: str` The amount that has been reclaimed from the unlock arrangement admin This will be the amount of the remaining unclaimed and locked at the time the reclaim is issued. - `amount_staked: str` The total amount of NEPT current staked by the addresses in this group. - `amount_unlocked: str` The total amount of NEPT currently unlocked **NOTE:** This does not factor in reclaimed or expired states. - For linear unlock schedules: - This represents the "progress" of unlocked NEPT from the time range between the `begins_at` and the `ends_at` properties. - For lump sum unlocks: - This will be 0 at any given time prior to the timestamp provided by the `begins_at` unlock property. - Once the time indicated by the `begins_at` property has been reached, this value will be the full amount of the unlock. - `extra: Extra` - `percent: Optional[ExtraPercent]` Percentages for unlock amounts. These do not factor in the `amount_staked` or `amount_held` values. Will not be null when query param `with_percent` is `true`. - `amount_claimable: str` - `amount_claimed: str` - `amount_expired: str` - `amount_locked: str` - `amount_reclaimed: str` - `amount_unlocked: str` - `extra: ExtraPercentExtra` - `text: Optional[ExtraPercentExtraText]` Human-readable variants of percentages for unlock amounts. Will not be null when query params `with_text` and `with_percent` are `true`. - `amount_claimable: str` - `amount_claimed: str` - `amount_expired: str` - `amount_locked: str` - `amount_reclaimed: str` - `amount_unlocked: str` - `text: Optional[ExtraText]` Human-readable field variants. Will not be null when query param `with_text` is `true`. - `amount: str` - `amount_claimable: str` - `amount_claimed: str` - `amount_expired: str` - `amount_held: str` - `amount_locked: str` - `amount_reclaimed: str` - `amount_staked: str` - `amount_unlocked: str` - `member_class: 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` - `amount_claimable: str` - `amount_claimed: str` - `amount_expired: str` - `amount_held: str` - `amount_locked: str` - `amount_reclaimed: str` - `amount_staked: str` - `amount_unlocked: 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` - `amount_claimable: str` - `amount_claimed: str` - `amount_expired: str` - `amount_held: str` - `amount_locked: str` - `amount_reclaimed: str` - `amount_staked: str` - `amount_unlocked: str` - `price: str` Text representation of price - `price: str` Price used in value calculations - `member_class: Literal["team", "advisor", "investor"]` The group category - `"team"` - `"advisor"` - `"investor"` - `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.nept.unlocks_distribution() print(response.data) ``` #### Response ```json { "data": { "groups": [ { "member_class": "team", "amount": "4000000000000", "amount_claimed": "1284964220023", "amount_claimable": "258879821935", "amount_unlocked": "1543844041957", "amount_locked": "2456155958043", "amount_reclaimed": "0", "amount_expired": "0", "amount_staked": "705873408356", "amount_held": "630912490948", "extra": { "text": { "amount_expired": "0.0000 NEPT", "amount_held": "630,912.4909 NEPT", "amount_claimable": "258,879.8219 NEPT", "amount_locked": "2,456,155.9580 NEPT", "amount_reclaimed": "0.0000 NEPT", "amount_unlocked": "1,543,844.0419 NEPT", "amount_claimed": "1,284,964.2200 NEPT", "amount": "4,000,000.0000 NEPT", "member_class": "Team", "amount_staked": "705,873.4083 NEPT" }, "percent": { "amount_claimable": "0.06471995548375", "amount_claimed": "0.32124105500575", "amount_reclaimed": "0", "amount_unlocked": "0.38596101048925", "amount_expired": "0", "amount_locked": "0.61403898951075", "extra": { "text": { "amount_expired": "0.00%", "amount_claimable": "6.47%", "amount_locked": "61.40%", "amount_claimed": "32.12%", "amount_unlocked": "38.59%", "amount_reclaimed": "0.00%" } } }, "value": { "amount_claimed": "41871.533695594570455504", "amount_held": "20558.762035590247713798", "amount_reclaimed": "0", "price": "0.032585758453916404", "amount_unlocked": "50307.329041728784267946", "amount": "130343.033815665616", "amount_expired": "0", "amount_staked": "23001.420383731313048179", "amount_claimable": "8435.795346166799570895", "amount_locked": "80035.704773936831732053", "extra": { "text": { "amount_locked": "$80,035.70", "amount_unlocked": "$50,307.32", "amount_expired": "$0.00", "price": "$0.03", "amount_claimed": "$41,871.53", "amount_claimable": "$8,435.79", "amount_reclaimed": "$0.00", "amount_staked": "$23,001.42", "amount": "$130,343.03", "amount_held": "$20,558.76" } } } } }, { "member_class": "advisor", "amount": "4000000000000", "amount_claimed": "1284964220023", "amount_claimable": "258879821935", "amount_unlocked": "1543844041957", "amount_locked": "2456155958043", "amount_reclaimed": "0", "amount_expired": "0", "amount_staked": "705873408356", "amount_held": "630912490948", "extra": { "text": { "amount_expired": "0.0000 NEPT", "amount_held": "630,912.4909 NEPT", "amount_claimable": "258,879.8219 NEPT", "amount_locked": "2,456,155.9580 NEPT", "amount_reclaimed": "0.0000 NEPT", "amount_unlocked": "1,543,844.0419 NEPT", "amount_claimed": "1,284,964.2200 NEPT", "amount": "4,000,000.0000 NEPT", "member_class": "Advisor", "amount_staked": "705,873.4083 NEPT" }, "percent": { "amount_claimable": "0.06471995548375", "amount_claimed": "0.32124105500575", "amount_reclaimed": "0", "amount_unlocked": "0.38596101048925", "amount_expired": "0", "amount_locked": "0.61403898951075", "extra": { "text": { "amount_expired": "0.00%", "amount_claimable": "6.47%", "amount_locked": "61.40%", "amount_claimed": "32.12%", "amount_unlocked": "38.59%", "amount_reclaimed": "0.00%" } } }, "value": { "amount_claimed": "41871.533695594570455504", "amount_held": "20558.762035590247713798", "amount_reclaimed": "0", "price": "0.032585758453916404", "amount_unlocked": "50307.329041728784267946", "amount": "130343.033815665616", "amount_expired": "0", "amount_staked": "23001.420383731313048179", "amount_claimable": "8435.795346166799570895", "amount_locked": "80035.704773936831732053", "extra": { "text": { "amount_locked": "$80,035.70", "amount_unlocked": "$50,307.32", "amount_expired": "$0.00", "price": "$0.03", "amount_claimed": "$41,871.53", "amount_claimable": "$8,435.79", "amount_reclaimed": "$0.00", "amount_staked": "$23,001.42", "amount": "$130,343.03", "amount_held": "$20,558.76" } } } } }, { "member_class": "investor", "amount": "4000000000000", "amount_claimed": "1284964220023", "amount_claimable": "258879821935", "amount_unlocked": "1543844041957", "amount_locked": "2456155958043", "amount_reclaimed": "0", "amount_expired": "0", "amount_staked": "705873408356", "amount_held": "630912490948", "extra": { "text": { "amount_expired": "0.0000 NEPT", "amount_held": "630,912.4909 NEPT", "amount_claimable": "258,879.8219 NEPT", "amount_locked": "2,456,155.9580 NEPT", "amount_reclaimed": "0.0000 NEPT", "amount_unlocked": "1,543,844.0419 NEPT", "amount_claimed": "1,284,964.2200 NEPT", "amount": "4,000,000.0000 NEPT", "member_class": "Investor", "amount_staked": "705,873.4083 NEPT" }, "percent": { "amount_claimable": "0.06471995548375", "amount_claimed": "0.32124105500575", "amount_reclaimed": "0", "amount_unlocked": "0.38596101048925", "amount_expired": "0", "amount_locked": "0.61403898951075", "extra": { "text": { "amount_expired": "0.00%", "amount_claimable": "6.47%", "amount_locked": "61.40%", "amount_claimed": "32.12%", "amount_unlocked": "38.59%", "amount_reclaimed": "0.00%" } } }, "value": { "amount_claimed": "41871.533695594570455504", "amount_held": "20558.762035590247713798", "amount_reclaimed": "0", "price": "0.032585758453916404", "amount_unlocked": "50307.329041728784267946", "amount": "130343.033815665616", "amount_expired": "0", "amount_staked": "23001.420383731313048179", "amount_claimable": "8435.795346166799570895", "amount_locked": "80035.704773936831732053", "extra": { "text": { "amount_locked": "$80,035.70", "amount_unlocked": "$50,307.32", "amount_expired": "$0.00", "price": "$0.03", "amount_claimed": "$41,871.53", "amount_claimable": "$8,435.79", "amount_reclaimed": "$0.00", "amount_staked": "$23,001.42", "amount": "$130,343.03", "amount_held": "$20,558.76" } } } } } ] }, "error": null, "status": 200, "status_text": "200 OK" } ```