ManifoldMarketManager.rule.generic

Contains generic rules, which don’t interact markets other than their assigned one, & don’t cause any mutations.

class ManifoldMarketManager.rule.generic.AdditiveRule(rules: list[Rule[T]] = NOTHING)[source]

Bases: VariadicRule[Union[Literal[‘CANCEL’], float]]

Return the sum of many other Rules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'The sum of the below'
_is_protocol = False
_value(market: Market) Literal['CANCEL'] | float[source]

Return the sum of the underlying rules.

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) VariadicRule[T]

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

logger: Logger
rules: list[Rule[T]]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.BothRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the AND of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve True if both of the below resolve to True, otherwise resolve False'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ConditionalRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Union[Literal[‘CANCEL’], bool, float]]

Cancels if the premise is false, and resolve to another value otherwise.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Cancels if the next line resolves False, otherwise resolves to the value of the item after'
_is_protocol = False
_value(market: Market) BinaryResolution[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.EitherRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the OR of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve True if either of the below resolves True, otherwise resolve False'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ImpliesRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the implication of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve True if the next line resolves False, otherwise resolves to the value of the item after'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ModulusRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Union[Literal[‘CANCEL’], float]]

Return the modulus of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'A mod B, where A is the next line and B the line after'
_is_protocol = False
_value(market: Market) Literal['CANCEL'] | float[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.MultiplicitiveRule(rules: list[Rule[T]] = NOTHING)[source]

Bases: VariadicRule[Union[Literal[‘CANCEL’], float]]

Return the product of many other Rules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'The product of the below'
_is_protocol = False
_value(market: Market) Literal['CANCEL'] | float[source]

Return the product of the underlying rules.

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) VariadicRule[T]

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

logger: Logger
rules: list[Rule[T]]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.NANDRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the NAND of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve True if one or more of the below resolves False, otherwise resolve False'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.NegateRule(child: Rule[T])[source]

Bases: UnaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Negate another DoResolveRule.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve False if the below is True, and vice versa'
_is_protocol = False
_value(market: Market) bool[source]
child: Rule[T]
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) UnaryRule[T]

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

logger: Logger
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.NeitherRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the NOR of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve False if either of the below resolve to True, otherwise resolve True'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ResolveAtTime(resolve_at: datetime)[source]

Bases: DoResolveRule

Return True if the specified time is in the past.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str[source]
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_is_protocol = False
_value(market: Market) bool[source]

Return True iff the current time is after resolve_at.

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
resolve_at: datetime
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ResolveMultipleValues(shares: MutableSequence[tuple[ResolutionValueRule, float]] = NOTHING)[source]

Bases: ResolutionValueRule

Resolve to multiple values with different shares.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str[source]
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_is_protocol = False
_value(market: Market) FreeResponseResolution | MultipleChoiceResolution[source]
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) ResolveMultipleValues[source]

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

logger: Logger
shares: MutableSequence[tuple[ResolutionValueRule, float]]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ResolveRandomIndex(seed: int | float | str | bytes | bytearray, *args: Any, size: Optional[int] = None, start: int = 0, **kwargs: Any)[source]

Bases: ResolveRandomSeed

Resolve to a random index in a market.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str[source]
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_is_protocol = False
_value(market: Market) int[source]
args: Sequence[Any]
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.

kwargs: JSONDict
logger: Logger
method: str
rounds: int
seed: int | float | str | bytes | bytearray
size: Optional[int]
start: int
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.ResolveToValue(resolve_value: T)[source]

Bases: Generic[T], Rule[T]

Resolve to a pre-specified value.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str[source]
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_is_protocol = False
_value(market: Market) T[source]
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
resolve_value: T
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.XNORRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the XNOR of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve True if the below resolve to the same value, otherwise resolve False'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.

class ManifoldMarketManager.rule.generic.XORRule(rule1: Rule[T], rule2: Rule[T])[source]

Bases: BinaryRule[Optional[Union[Literal[‘CANCEL’], bool, float]]]

Return the XOR of two other DoResolveRules.

_abc_impl = <_abc_data object>
_explain_abstract(indent: int = 0, **kwargs: Any) str
_explain_specific(market: Market, indent: int = 0, sig_figs: int = 4) str
_explainer_stub: ClassVar[str] = 'Resolve False if the below resolve to the same value, otherwise resolve True'
_is_protocol = False
_value(market: Market) bool[source]
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) BinaryRule[T]

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

logger: Logger
rule1: Rule[T]
rule2: Rule[T]
tags_used: set[str]
value(market: Market, format: Literal['NONE'] | OutcomeType = 'NONE', refresh: bool = False) AnyResolution

Return the resolution value of a market, appropriately formatted for its market type.