ManifoldMarketManager.market

Contains the Market class, which associates Rules with a market on Manifold.

class ManifoldMarketManager.market.Market(market: APIMarket, notes: str = '', account: Account = <factory>, do_resolve_rules: list[Rule[Optional[bool]]] = <factory>, resolve_to_rules: list[Rule[AnyResolution]] = <factory>)[source]

Bases: DictDeserializable

Represent a market and its corresponding rules.

Events

before_check(market: Market): after_check(market: Market):

Called before/after a market is checked. Please don’t put anything intensive in here.

before_create(market: Market): after_create(market: Market):

Called before/after a market is created.

before_resolve(market: Market, outcome: AnyResolution): after_resolve(market: Market, outcome: AnyResolution, response: Response):

Called before/after a market is resolved. Please don’t put anything intensive in here.

before_remove(market: Market): after_remove(market: Market):

Called before/after a market is removed from the database.

__format_resolve_to(sig_figs: int) str
_after_resolve(market: Market, outcome: AnyResolution, response: Response) None[source]
account: Account
cancel(**kwargs: Any) T
client: ManifoldClient
current_answer() AnyResolution[source]

Return the current market consensus.

do_resolve_rules: list[Rule[Optional[bool]]]
event_emitter: EventEmitter
explain_abstract(**kwargs: Any) str[source]

Explain how the market will resolve and decide to resolve.

explain_specific(sig_figs: int = 4) str[source]

Explain why the market is resolving the way that it is.

classmethod from_dict(env: ModJSONDict) Market[source]

Take a dictionary and return an instance of the associated class.

classmethod from_id(id: str, *args: Any, **kwargs: Any) Market[source]

Reconstruct a Market object from the market ID and other arguments.

classmethod from_slug(slug: str, *args: Any, **kwargs: Any) Market[source]

Reconstruct a Market object from the market slug and other arguments.

classmethod from_url(url: str, *args: Any, **kwargs: Any) Market[source]

Reconstruct a Market object from the market url and other arguments.

property id: str

Return the ID of a market as reported by Manifold.

logger: Logger = None
market: APIMarket
notes: str = ''
on(*args, **kwargs)[source]

Register an event with EventEmitter.

refresh() None[source]

Ensure market data is recent.

resolve(**kwargs: Any) T
resolve_to() AnyResolution[source]

Select a value to be resolved to.

This is done by iterating through a series of Rules, each of which have opportunity to recommend a value. The first resolved value is resolved to.

Binary markets must return a float between 0 and 100. Numeric markets must return a float in its correct range. Free response markets must resolve to either a single index integer or

a mapping of indices to weights.

Any rule may return “CANCEL” to instead refund all orders.

resolve_to_rules: list[Rule[AnyResolution]]
should_resolve() bool[source]

Return whether the market should resolve, according to our rules.

property status: MarketStatus

Return whether a market is OPEN, CLOSED, or RESOLVED.