Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #73 from cowprotocol/quote_in_market_classification
Browse files Browse the repository at this point in the history
In-market classification for fill-or-kill limit orders
fhenneke authored Jan 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 301018a + 2ea8a77 commit 584888b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sql/orderbook/order_rewards.sql
Original file line number Diff line number Diff line change
@@ -115,9 +115,10 @@ order_surplus AS (
FROM trades t
INNER JOIN orders o ON order_uid = uid
JOIN order_quotes oq ON t.order_uid = oq.order_uid
WHERE ((o.kind = 'sell' AND o.buy_amount <= oq.buy_amount)
OR (o.kind='buy' AND o.sell_amount >= oq.sell_amount))
AND o.partially_fillable='f'
WHERE (o.class = 'market'
OR (o.kind = 'sell' AND (oq.sell_amount - oq.gas_amount * oq.gas_price / oq.sell_token_price) * oq.buy_amount >= o.buy_amount * oq.sell_amount)
OR (o.kind='buy' AND o.sell_amount >= oq.sell_amount + oq.gas_amount * oq.gas_price / oq.sell_token_price))
AND o.partially_fillable='f' -- the code above might fail for partially fillable orders
AND block_number > {{start_block}}
AND block_number <= {{end_block}}
AND oq.solver != '\x0000000000000000000000000000000000000000')

0 comments on commit 584888b

Please sign in to comment.