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()

block = client.get_block() account = client.get_account("v2.ref-finance.near") pools = client.get_pools() pool = client.get_pool(pool_id=1) deposits = client.get_deposits(account_id="user.near", contract="v2.ref-finance.near") tvl = client.pool_tvl_estimate(pool_id=1)

near = client.yocto_to_near("1000000000000000000000000") yocto = client.near_to_yocto(1.0)

client.close()

API Reference

DefiAnalyticsPyClient(rpc_url, timeout)

Parameter Default Description
rpc_url NEAR mainnet RPC Custom RPC endpoint
timeout 30 Request timeout in seconds

Methods

Method Description
get_block() Fetch latest block
get_account(account_id) Fetch account state
get_pools(contract) List all pools
get_pool(pool_id, contract) Fetch a single pool
get_deposits(account_id, contract) Fetch account deposits
pool_tvl_estimate(pool_id, contract) Estimate pool TVL
yocto_to_near(yocto) Convert yoctoNEAR → NEAR
near_to_yocto(near) Convert NEAR → yoctoNEAR
close() Close the HTTP session

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.3.tar.gz (3.7 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.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: defi_analytics_py-1.0.3.tar.gz
  • Upload date:
  • Size: 3.7 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.3.tar.gz
Algorithm Hash digest
SHA256 6c81cd07aaef762beea4a21616b4baf530ccdcd3b46f5e170faf2c825d58ad59
MD5 1ec1a6fe4c094c5c8cc83184212fffad
BLAKE2b-256 bdc284402070b6f14702ab3d3aeabcf0b1b32f84dd02d92787f4162a94574ba8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for defi_analytics_py-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dc49182a9453e129fa851662e6f8fe219f39d4ab5fcd097332c75ae838c6f6db
MD5 76346bbbd13ddf4554fb26eea2752ced
BLAKE2b-256 9f972a770326eda82c405670215106b2eaa82dc34098686529f1c09b3693f66e

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