Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Improved Market Filters

See original GitHub issue

We 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:

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
num_shares = min(10_percent_shares, smallest_side_amount)
bid_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
if(order.quantity + quantity_gotten > num_shares):
order.quantity = num_shares - quantity_gotten
quantity_gotten += order.quantity

if (numShares == 0) {
// one or both sides of order book was empty; we'll pretend instead
numShares = 1;
if (totalBidQuantity == 0) {
// bid side of order book was empty
bidValue = minPrice
}
// note this isn't an "else if" anymore so that both bid/bask set to min/max if entire book empty
// ask side of order book was empty
BidValue = bid_value / bid_quantity
}
}

outcomes += 1

// max spread across all outcomes

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

1reaction
joeykrugcommented, May 5, 2019

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

1reaction
bthailecommented, May 3, 2019

@ryanberckmans yes, coordinate changes with @phoebemirman , she is running the UI portion.

#### 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...
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.
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...
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”.
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...

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free