LP-API subscriptions
lp_subscribe_order_fills
A subscription that lists all the orders that have been filled/partially filled by swaps in each finalized block. Note swaps are only considered done once they are in a finalized block.
Parameters: None
Return:
- Block hash
- Block number
- JSON array of all the fills in this finalized block.
- For range order fills these look like this:
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": { "chain": "Ethereum", "asset": "FLIP"},
"quote_asset": { "chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
# The fees that were earned by this fill
"fees": {
"base": "0x13fbe85edc90000",
"quote": "0x1e63a"
},
# The liquidity inside the filled range order. Note this liquidity number is not changed by fills
"liquidity": "0x7055df27b7e148"
}
}
- For limit order fills these look like this:
{
"limit_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": { "chain": "Ethereum", "asset": "FLIP"},
"quote_asset": { "chain": "Ethereum", "asset": "USDC"},
# The side of the order that was filled
"side": "buy",
"id": "0x0",
"tick": 0,
# The amount of the order that was used, in the units of the asset that was sold (by the order)
"sold": "0x1200",
# The amount assets bought during this fill, in the units of the bought asset
"bought": "0x1200",
# The fees earned during this fill, in units of the bought asset (Which in the asset you actually earn the fees in)
"fees": "0x100",
# The remaining amount in the order after the fill. This is in units of the sold asset.
"remaining": "0x100000",
}
}
Example
curl -H "Content-Type: application/json" -d '{
"id": 1,
"jsonrpc": "2.0",
"method": "lp_subscribe_order_fills",
"params": []
}' http://localhost:10589
{
"jsonrpc": "2.0",
"method": "lp_subscribe_order_fills",
"params": {
"subscription": 4818071931255759,
"result": {
"block_hash": "0xc65c18f81c4a9b1b5cd7e203f09eaa2288b44771e13d43791e1319a2695c72e9",
"block_number": 67,
"fills": [
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Ethereum", "asset": "FLIP"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x13fbe85edc90000",
"quote": "0x1e63a"
},
"liquidity": "0x7055df27b7e148"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Polkadot", "asset": "DOT"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x0",
"quote": "0x1d33c"
},
"liquidity": "0x2e033968552"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Ethereum", "asset": "ETH"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x330b9eb022000",
"quote": "0x262d6"
},
"liquidity": "0xb3bc983f8c9bb"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Bitcoin", "asset": "BTC"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x2bc",
"quote": "0x6a5dd"
},
"liquidity": "0x253fca1c0"
}
}
]
}
}
}
{
"jsonrpc": "2.0",
"method": "lp_subscribe_order_fills",
"params": {
"subscription": 4818071931255759,
"result": {
"block_hash": "0x09af8fa48149d182e26eee32f6bab6b871af4cee613367c2cf986a9e29ecc6ac",
"block_number": 68,
"fills": [
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Ethereum", "asset": "ETH"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x330b9eb022000",
"quote": "0x1d67b"
},
"liquidity": "0xb3bc983f8c9bb"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Ethereum", "asset": "FLIP"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x13fbe85edc90000",
"quote": "0x1a599"
},
"liquidity": "0x7055df27b7e148"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Bitcoin", "asset": "BTC"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x0",
"quote": "0x5958e"
},
"liquidity": "0x253fca1c0"
}
},
{
"range_order": {
"lp": "cFPdef3hF5zEwbWUG6ZaCJ3X7mTvEeAog7HxZ8QyFcCgDVGDM",
"base_asset": {"chain": "Polkadot", "asset": "DOT"},
"quote_asset": {"chain": "Ethereum", "asset": "USDC"},
"id": "0x0",
"range": {
"start": -887272,
"end": 887272
},
"fees": {
"base": "0x5f5e100",
"quote": "0x1341e"
},
"liquidity": "0x2e033968552"
}
}
]
}
}
}
{
"jsonrpc": "2.0",
"method": "lp_subscribe_order_fills",
"params": {
"subscription": 4818071931255759,
"result": {
"block_hash": "0xd8f0f1833fc7e98458cc300dce85e56450aa19aabd8883f6c6cbcc8d97a8cc7a",
"block_number": 69,
"fills": []
}
}
}
Last updated on