Bug Report
Confirmation
Expected Behavior
In PolymarketInstrumentProvider._load_markets(), when filtering for active markets, one would expect markets to be loaded that are truly active, as per the implicit definition in the polymarket gamma API documentation, namely markets that are not "closed"
Actual Behavior
However, the function filters for markets whose "active" keyword is set to "true". I'm not sure what this keyword exactly represents, but I believe it just means that one can trade on the market. I suppose the distinction between closed and active exists for when the closing of a market gets successfully disputed
Steps to Reproduce the Problem
- Create a
PolyMarketInstrumentProvider instance
- Run
instrument_provider.load_all_async(filters={'is_active' : True})
- Count the elements in
instrument_provider.get_all().keys()
- Compare this to running
instrument_provider.load_all_async(), without filters
Suggested Fix
In nautilus_trader/adapters/polymarket/providers.py, line 9, starts the following snippet:
active = market_info["active"]
if filter_is_active and not active:
continue
Change to this:
closed = market_info["closed"]
if filter_is_active and closed:
continue
A fork was created with exactly this fix, see branch fix/polymarket-filtering
Specifications
- OS platform: Linux
- Python version: latest
nautilus_trader version: latest commit on devlopment branch
Bug Report
Confirmation
devdevelop oranightly) and can still reproduce it.Expected Behavior
In
PolymarketInstrumentProvider._load_markets(), when filtering for active markets, one would expect markets to be loaded that are truly active, as per the implicit definition in the polymarket gamma API documentation, namely markets that are not "closed"Actual Behavior
However, the function filters for markets whose "active" keyword is set to "true". I'm not sure what this keyword exactly represents, but I believe it just means that one can trade on the market. I suppose the distinction between closed and active exists for when the closing of a market gets successfully disputed
Steps to Reproduce the Problem
PolyMarketInstrumentProviderinstanceinstrument_provider.load_all_async(filters={'is_active' : True})instrument_provider.get_all().keys()instrument_provider.load_all_async(), without filtersSuggested Fix
In
nautilus_trader/adapters/polymarket/providers.py, line 9, starts the following snippet:Change to this:
A fork was created with exactly this fix, see branch fix/polymarket-filtering
Specifications
nautilus_traderversion: latest commit on devlopment branch