Skip to main content

PyPI - defi-analytics-py v4

Project description

defi-analytics-py

DeFi analytics library for NEAR Protocol.

PyPI version Python

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

defi_analytics_py-1.0.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

defi_analytics_py-1.0.4-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file defi_analytics_py-1.0.4.tar.gz.

File metadata

  • Download URL: defi_analytics_py-1.0.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for defi_analytics_py-1.0.4.tar.gz
Algorithm Hash digest
SHA256 d0905787d93affa9ef6bea25b6b0866d0ac5938246618b93c2ef8a9fe59650a9
MD5 fe10a598cf88fc42e7e7ff467d371947
BLAKE2b-256 08adaa4be131ce4f08cb5268b4a6a6a1e61297770007d88718a8c76371fe286a

See more details on using hashes here.

File details

Details for the file defi_analytics_py-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for defi_analytics_py-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dd3a58c6356575edcdf840beb628701f04d01d991b1190d6f1dee0ccd735f75f
MD5 ab2ecc327831c0838af306c5458ed2cd
BLAKE2b-256 d9444e2ae7deb9f27aaf7af315f3d698ecc988923ef9b1746bf1b8f92db2cbad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page