defi-analytics-py
DeFi analytics library for NEAR Protocol.
Installation
pip install defi-analytics-py
Requires Python 3.9+
Quick Start
from defi_analytics_py import DefiAnalyticsPyClient
client = DefiAnalyticsPyClient()
Methods
Chain
| Method | Description |
|---|---|
get_latest_block() |
Fetch the latest block |
get_gas_price() |
Get current gas price |
Accounts
| Method | Description |
|---|---|
get_account(account_id) |
Get account details |
get_near_balance(account_id) |
Get NEAR token balance |
Fungible Tokens
| Method | Description |
|---|---|
get_ft_metadata(contract_id) |
Get token metadata |
get_ft_balance(contract_id, account_id) |
Get token balance for account |
Pools (Ref Finance)
| Method | Description |
|---|---|
get_pools() |
List all liquidity pools |
get_pool(pool_id) |
Get a specific pool |
get_pool_tvl(pool_id) |
Get TVL for a pool |
top_pools_by_tvl(n) |
Return top n pools by TVL |
Example
from defi_analytics_py import DefiAnalyticsPyClient
client = DefiAnalyticsPyClient()
Chain info
block = client.get_latest_block() gas = client.get_gas_price()
Account
balance = client.get_near_balance("alice.near")
Pools
top = client.top_pools_by_tvl(10) tvl = client.get_pool_tvl(79)
Custom RPC
client = DefiAnalyticsPyClient(rpc_url="https://rpc.mainnet.near.org", timeout=60)
License
MIT
Metadata
Release files for defi-analytics-py 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| defi_analytics_py-1.0.4.tar.gz | 3.5 kB | Without provenance | Details for defi_analytics_py-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| defi_analytics_py-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for defi_analytics_py-1.0.4-py3-none-any.whl |
Total release size: 7.3 kB
Release files / defi_analytics_py-1.0.4.tar.gz
| Download URL | defi_analytics_py-1.0.4.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0905787d93affa9ef6bea25b6b0866d0ac5938246618b93c2ef8a9fe59650a9
|
|
BLAKE2b-256 checksum How to use checksums |
08adaa4be131ce4f08cb5268b4a6a6a1e61297770007d88718a8c76371fe286a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / defi_analytics_py-1.0.4-py3-none-any.whl
| Download URL | defi_analytics_py-1.0.4-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd3a58c6356575edcdf840beb628701f04d01d991b1190d6f1dee0ccd735f75f
|
|
BLAKE2b-256 checksum How to use checksums |
d9444e2ae7deb9f27aaf7af315f3d698ecc988923ef9b1746bf1b8f92db2cbad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for defi-analytics-py 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.