Skip to content

Instantly share code, notes, and snippets.

{
"timestamp": "2025-07-31T15:33:13.283659Z",
"payload": [
{
"asset_id": "27754487970411878834344315616304366094263896584748903766271808951117586529208",
"bucket_index": "0",
"event_type": "trade",
"fee_rate_bps": "0",
"id": "4faaa309-fad1-43fe-bcf4-5c810a007ed9",
"last_update": "1753975991",
-- Declare params
DECLARE vault_account STRING;
SET vault_account = 'dydx1c0m5x87llaunl5sgv3q5vd7j5uha26d2q2r2q0';
-- Get vault fills
WITH vault_trades AS (
SELECT
block_timestamp
, perpetual_id
, CASE
@cbergz
cbergz / vault_activity
Created October 24, 2024 02:53
Vault activity query on Numia
WITH
vaults AS (
SELECT
vault
FROM
UNNEST(['dydx1esh4d4rdl58lqauha8met8g78xry52ry3nnmw6', 'dydx1cnd3ftpvqr3khjsfn6ptz0a8fzd99p4dnmkt2l', 'dydx165fla2xss0wrg8rr04x3e46mneat4fckrcf429', 'dydx16fg2j83kkzwz9ghqrdgatzsnsfz7mzknz0e8yw', 'dydx1ge5qgepfxcjetkgvfgcph05zcv78we53w2g5h7', 'dydx12dffextgdnvrv349krs2thvhcdnwr4850d35h7', 'dydx19ykejm094kzj054wt3lks3fk9kuwfu9h0z8hcs', 'dydx10vwegs2dyjm6443uqpp0y7v9u4snmcnu5wpgnr', 'dydx1qsyv2ug8y0m5xgapfr6avrj9ktu79pyq49pphg', 'dydx1l04nf4udw7swyrzge66j66n09ry4aawfm4xd07', 'dydx1kywd7tcyvpwx8j6dc7t5733wmum4k2dq68trn6', 'dydx1m0pn0ygh37qp345rd44scq58ch7e4h0wfpdrcs', 'dydx1vvdpmwsyum9r5y92c3gpks5ednxqazfmpjv8qf', 'dydx1rtkg76uvpll6jhvm79knsrqaf9vx48wcfn7she', 'dydx186d03739dhkt8eeqahql3dcscyvgh9f6gsuzxn', 'dydx1c5atsq350zsdwzld4e9k648cx4rkr9792e4xtp', 'dydx16hklzgswcw9w4xhh4vdajlclaghwzgmr2m6hlp', 'dydx1c6s0pg7hsc9enyr4nn9vhmyk8yps3wkhvlr0fz', 'dydx1y73m286vcnvrjnrcwv7d7l4gs2v2x5r65n7726', 'dydx1ypya4270fm4gujvktk67ldvru3y2nx7pvud7ej', 'dydx1mt66ymx2vv7dzct3t0h6m
from pycoingecko import CoinGeckoAPI
import pandas as pd
cg = CoinGeckoAPI()
dydx_trades = cg.get_coin_ohlc_by_id("dydx", "usd", 7)
dydx_df = pd.DataFrame(dydx_trades, columns=['time', 'open', 'high', 'low', 'close'])
twap_price = dydx_df[['open', 'high', 'low', 'close']].mean(axis=None)
print(twap_price)
## Ran on Feb 19th at 18:00 UTC
{
"title": "Min Deposit and Max Deposit Period Change",
"deposit": "1000000adv4tnt",
"summary": "This is a proposal to decrease the min deposit and increase max deposit period.",
"messages": [
{
"@type": "/cosmos.gov.v1.MsgExecLegacyContent",
"content": {
"@type": "/cosmos.params.v1beta1.ParameterChangeProposal",
"changes": [
@cbergz
cbergz / gist:110cd9cefc11ec34aa179b32dcc0ef7b
Created February 12, 2024 15:01
Gov Params Update Proposal
{
"title": "Min Deposit and Max Deposit Period Change",
"deposit": "1000000adv4tnt",
"summary": "Test proposal to decrease min_deposit and increase max_deposit_period.",
"messages": [
{
"@type": "/cosmos.gov.v1.MsgUpdateParams",
"authority": "dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky",
"params": {
"min_deposit": [{"amount": "100000000", "denom": "adv4tnt"}],
@cbergz
cbergz / unsigned_proposal.json
Last active January 22, 2024 16:46
Season 1 Rewards Proposal
{"body":{"messages":[{"@type":"/cosmos.gov.v1.MsgSubmitProposal","messages":[{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx100l9m6g70j28g2tk3jj4plmge8vsmj6jdrlzhk","coin":{"denom":"adydx","amount":"206151260000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx1g6vlujs2fw7c4886uc8g092474d54uhcf2swrg","coin":{"denom":"adydx","amount":"195541810000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx1ph7ek4yk82gdaw0r4yzluuchxwe96yrjdjq9wr","coin":{"denom":"adydx","amount":"161947650000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr7
@cbergz
cbergz / unsigned_proposal_tx.json
Created January 16, 2024 17:45
Launch Incentives Proposal
{"body":{"messages":[{"@type":"/cosmos.gov.v1.MsgSubmitProposal","messages":[{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx100l9m6g70j28g2tk3jj4plmge8vsmj6jdrlzhk","coin":{"denom":"adydx","amount":"206151260000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx1g6vlujs2fw7c4886uc8g092474d54uhcf2swrg","coin":{"denom":"adydx","amount":"195541810000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky","sender_module_name":"community_treasury","recipient":"dydx1ph7ek4yk82gdaw0r4yzluuchxwe96yrjdjq9wr","coin":{"denom":"adydx","amount":"161947650000000000000000"}},{"@type":"/dydxprotocol.sending.MsgSendFromModuleToAccount","authority":"dydx10d07y265gmmuvt4z0w9aw880jnsr7
WITH
taker AS (
SELECT
"taker" AS user_side,
JSON_EXTRACT_SCALAR(m.attributes, '$.tx_msg_type') AS order_type,
JSON_EXTRACT_SCALAR(m.attributes, '$.timestamp') AS order_submitted_time,
m.publish_time AS numia_publish_time,
(
SELECT
MAX(block_timestamp)
{
"mev_node_to_node": {
"validator_mev_matches": {
"matches": [
{
"taker_order_subaccount_id": {
"owner": "dydx17cyzu9lmhszszspy33jtk6adgzkaunksr4eedt"
},
"taker_fee_ppm": 500,
"maker_order_subaccount_id": {