Fei
Examples
Note
These examples are crafted as a Jupyter notebook. You can download the original notebook file here.
Also note that inside Jupyter notebooks, await
can be used freely outside of asyncio.run()
.
In [1]:
from ctc.protocols import fei_utils
Get PCV stats¶
In [2]:
pcv_stats = await fei_utils.async_get_pcv_stats()
pcv_stats
Out[2]:
{'pcv': 59598260820495064263161827, 'user_fei': 58131106108824886492750185, 'protocol_equity': 1467154711670177770411642, 'valid': True}
Get PCV stats in a specific block¶
In [3]:
pcv_stats = await fei_utils.async_get_pcv_stats(block=14000000)
pcv_stats
Out[3]:
{'pcv': 782812519953585480931863885, 'user_fei': 321723324105548204271934214, 'protocol_equity': 461089195848037276659929671, 'valid': True}
Print PCV asset summary¶
In [4]:
await fei_utils.async_print_pcv_assets()
┌────────────────┐ │ Fei PCV Assets │ └────────────────┘
total $59.60M
asset │ amount │ price │ total ─────────┼───────────┼─────────────┼──────────── LUSD │ 0 │ $1.03 │ $0.00 WETH │ 230.71 │ $1,287.97 │ $297.15K DAI │ 58.13M │ $1.00 │ $58.11M BAL │ 226.44K │ $5.26 │ $1.19M
Print PCV deposit summary¶
In [5]:
await fei_utils.async_print_pcv_deposits()
┌──────────────────┐ │ FEI PCV Deposits │ └──────────────────┘
asset │ balance │ name │ address ─────────┼─────────────┼─────────────────────┼────────────────────────────────────────────── LUSD │ $0.00 │ │ 0x4378de2f2991fbed6616b34ac7727e7653713712 WETH │ $0.00 │ │ 0xc6d675ca5217d39c3a5e366141060fc2d1ea2b82 WETH │ $1.85e-13 │ │ 0xf24401f6992faeacbc5d6c6991db15b5f8364a1b WETH │ $1.29e-15 │ │ 0x6e5f2745c08249a190239763706473be0b72816d WETH │ $297.15K │ Balancer Pool2 │ 0xd8eb546726d449fc1ded06dfeca800a2fa8bb930 DAI │ $0.00 │ │ 0x8ffae111ab06f532a18418190129373d14570014 DAI │ $3.55e-12 │ │ 0xdf9ff5c077d9f3427ade67ac2d27a864be6f3187 DAI │ $58.11M │ │ 0x7842186cdd11270c4af8c0a99a5e0589c7f249ce BAL │ $0.00 │ Balancer BAL-WETH │ 0xcd1ac0014e2ebd972f40f24df1694e6f528b2fd4 BAL │ $1.19M │ Balancer veBAL │ 0x8cba3149b95084a61bbab9e01110b0fb92c9a289 BAL │ $0.00 │ │ 0x66977ce30049cd0e443216bf26377966c3a109e2
┌─────────────────┐ │ FEI Deployments │ └─────────────────┘
asset │ balance │ name │ address ─────────┼───────────┼────────┼────────────────────────────────────────────── FEI │ $2.63M │ │ 0x614d46b7eb2ac1a359b8835d64954f3ee4e6f676
Create data payload for app.fei.money/analytics
¶
In [6]:
payload = await fei_utils.async_create_payload(timescale='30d,1d')
Reference
- async ctc.protocols.fei_utils.async_create_payload(*, blocks=None, timestamps=None, timescale=None, end_time=None, window_size=None, interval_size=None, provider=None)
create data payload from scratch
- async ctc.protocols.fei_utils.async_get_pcv_stats(block=None, *, wrapper=False, provider=None)
- async ctc.protocols.fei_utils.async_get_pcv_stats_by_block(blocks, *, wrapper=False, provider=None, nullify_invalid=True)
- async ctc.protocols.fei_utils.async_print_pcv_assets(block=None)
- async ctc.protocols.fei_utils.async_print_pcv_deposits(block=None)