Improved Market Filters
See original GitHub issueWe now have an idea for a filter to filter markets by spread, the algorithm is below. This’ll filter out illiquid markets from a spread perspective but also ones that’re doing validity arbitrage at really bad prices (i.e. the markets that’re referred to on reddit as being ones to watch out for). So it solves a big problem right now for helping people avoid markets with bad prices that expire before they should.
UI wise this should be just like the fees filter where you can filter by Fee < X %, but instead Spread < X %.
So we need the:
- Design for this (simple + functional / not overthought, it’ll be redone when we do the markets listing page)
- AN endpoints for this
- UI dev for this
So the algo would be:
Spread = []
outcomes = 0
For outcome in market (if binary or scalar, just for yes outcome):
10_percent_shares = max(sum(ask_quantities), sum(bid_quantities)) * 0.10
smallest_side_amount = min(sum(ask_quantities), sum(bid_quantities))
num_shares = min(10_percent_shares, smallest_side_amount)
bid_value = 0
ask_value = 0
// the getters return a dictionary of orders w/ quantity and price, returns an empty one if num_shares is 0
bid_quantity = 0
quantity_gotten = 0
for order in get_orders_up_to_num_shares_quantity(bids, num_shares):
if(order.quantity + quantity_gotten > num_shares):
order.quantity = num_shares - quantity_gotten
bid_value += order.quantity * order.price
quantity_gotten += order.quantity
bid_quantity = quantity_gotten
quantity_gotten = 0
for order in get_orders_up_to_num_shares_quantity(asks, num_shares):
if(order.quantity + quantity_gotten > num_shares):
order.quantity = num_shares - quantity_gotten
ask_value += order.quantity * order.price
quantity_gotten += order.quantity
ask_quantity = quantity_gotten
if (numShares == 0) {
// one or both sides of order book was empty; we'll pretend instead
// it/each had 1 share to facilitate calculating spreadPercent.
numShares = 1;
if (totalBidQuantity == 0) {
// bid side of order book was empty
bidValue = minPrice
askValue = ask_value / ask_quantity
}
// note this isn't an "else if" anymore so that both bid/bask set to min/max if entire book empty
if (totalAskQuantity == 0) {
// ask side of order book was empty
askValue = maxPrice
BidValue = bid_value / bid_quantity
}
}
Spread[outcomes] = (ask_value - bid_value) / ((max - min)*num_shares)
outcomes += 1
// max spread across all outcomes
spread_percent = max(Spread)
Filter out markets by spread % < x
This should be part of the markets listing epic (on mobile so can’t add it to it atm)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:27 (19 by maintainers)
Top Results From Across the Web
Filters Market Size & Share, Trends Report, 2022-2030
The global filters market size was estimated at USD 72.33 billion in 2021 and ... as ICE filters are widely used in automobiles...
Read more >Top 5 MOST EFFECTIVE Strategy Filters
Here are my top 5 trading strategy filters that I use to enhance the performance of my trading and investment strategies.
Read more >Filters Global Market Report 2022
The global filters market size is expected to grow from $68.28 billion in 2021 to $72.23 billion in 2022 at a compound annual...
Read more >Filters Market Size is expected to reach at USD 111.9
Acumen Research and Consulting recently published report titled “Filters Market, Analysis Report and Region Forecast, 2022 - 2030”.
Read more >Filters Market Size Global Report, 2022 - 2030
Industry Dynamics. Growth Drivers The filters market is anticipated to be driven by an increase in demand from the automotive industry for the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Spread filter is the same as above.
This idea would be a separate feature called the Experimental Invalid Filter (checked by default):
if best bid <= range/num_outcomes+min + oi_fee/4 and best ask >= range/num_outcomes+min - oi_fee/4
For any of the outcomes in a market then a market is filtered out, else it appears@ryanberckmans yes, coordinate changes with @phoebemirman , she is running the UI portion.