ManifoldMarketManager
Manifold Market Manager Library.
This module provides the ability to construct a Manifold Markets manager bot. In particular, it gives you a framework to have automatically resolving markets. A future goal may be to allow trading, but this will likely be done using limits, rather than time sensitive trades. Expect intervals of minutes, not microseconds.
In order to use this library, some things need to be loaded in your environment variables. See the comments below for more information on this.
- class ManifoldMarketManager.DoResolveRule[source]
Bases:
Rule
[Optional
[bool
]]The subtype of rule which determines if a market should resolve, returning a bool.
- _abc_impl = <_abc_data object>
- abstract _explain_abstract(indent: int = 0, **kwargs: Any) str
- _is_protocol = False
- explain_abstract(indent: int = 0, **kwargs: Any) str
Explain how the market will resolve and decide to resolve.
- explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
Explain why the market is resolving the way that it is.
- classmethod from_dict(env: ModJSONDict) T
Take a dictionary and return an instance of the associated class.
- logger: Logger
- tags_used: set[str]
- class ManifoldMarketManager.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
- cancel(**kwargs: Any) T
- client: ManifoldClient
- 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 = ''
- 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.
- property status: MarketStatus
Return whether a market is OPEN, CLOSED, or RESOLVED.
- class ManifoldMarketManager.ResolutionValueRule[source]
Bases:
Rule
[Union
[Literal
[‘CANCEL’],bool
,float
,Mapping
[str
,float
],Mapping
[int
,float
],Mapping
[float
,float
]]]The subtype of rule which determines what a market should resolve to.
- _abc_impl = <_abc_data object>
- abstract _explain_abstract(indent: int = 0, **kwargs: Any) str
- _is_protocol = False
- explain_abstract(indent: int = 0, **kwargs: Any) str
Explain how the market will resolve and decide to resolve.
- explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
Explain why the market is resolving the way that it is.
- classmethod from_dict(env: ModJSONDict) T
Take a dictionary and return an instance of the associated class.
- logger: Logger
- tags_used: set[str]
- class ManifoldMarketManager.Rule[source]
Bases:
ABC
,Generic
[T
],DictDeserializable
The basic unit of market automation, rules defmine how a market should react to given events.
- _abc_impl = <_abc_data object>
- _is_protocol = False
- explain_abstract(indent: int = 0, **kwargs: Any) str [source]
Explain how the market will resolve and decide to resolve.
- explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str [source]
Explain why the market is resolving the way that it is.
- classmethod from_dict(env: ModJSONDict) T
Take a dictionary and return an instance of the associated class.
- logger: Logger
- tags_used: set[str]