Market Structure¶
-
class
markets.models.
Account
(*args, **kwargs)[source]¶ Represents a user’s bank account for a given market. Normal users are allowed only a primary account while admin users can create multiple secondary accounts.
-
class
markets.models.
AccountBalance
(*args, **kwargs)[source]¶ Represents the current holdings of an account for a given outcome (variable).
Contains the amount of shares held by present by the account owner.
-
class
markets.models.
DataSet
(id, market, name, description, is_training, is_active, datum_count, active_datum_id, challenge_start, reveal_interval)[source]¶ -
-
challenge_end
()[source]¶ Gets the DateTime the active challenge ends at.
If this challenge has a negative duration, it is assumed to continue indefinitely.
-
force_advance
()[source]¶ Forces the finalisation of this dataset’s current challenge and start the new one.
-
get_datum
(set_id)[source]¶ Gets the datum with the specified set_id. Throws an exception if it does not exist.
-
next
()[source]¶ Advances this active set to the next datum (challenge) _once_, and raises the dataset_expired signal. If there is no datum with such id, the set is made inactive. Returns whether the set is active.
-
next_challenge_id
()[source]¶ Gets the id of the next challenge (datum). Throws an exception if there is no such datum.
-
-
class
markets.models.
Datum
(*args, **kwargs)[source]¶ Represents an observation in the prediction market.
Defines a result for each event that was observed in this instance, along with a description specific to the observation.
-
class
markets.models.
Document
(*args, **kwargs)[source]¶ A document uploaded by the user to be potentially used as a dataset source.
-
class
markets.models.
Event
(*args, **kwargs)[source]¶ A set of outcomes for a market.
-
activity_histogram
(dt_from, dt_to, interval)[source]¶ Gets the amount of trades that occured in the given time interval.
-
-
class
markets.models.
Market
(id, name, description, pub_date, type)[source]¶ -
-
challenge_end_ticks
()[source]¶ Gets the challenge_end datetime in the form of ticks elapsed since the Epoch.
-
challenge_start_ticks
()[source]¶ Gets the challenge_start datetime in the form of ticks elapsed since the Epoch.
-
create_primary_account
(u)[source]¶ Creates a primary account for the given user. Throws an exception if the account exists.
-
-
class
markets.models.
MarketBalance
(*args, **kwargs)[source]¶ The current market supply for a given outcome.
-
class
markets.models.
MarketType
[source]¶ The different types of markets with regard to the market maker that is used.
-
class
markets.models.
Order
(*args, **kwargs)[source]¶ A pending or already processed order from a user for some market
-
group_by_event
()[source]¶ Groups all positions in this order by their event. Returns a dictionary of the events with the list of positions on them as the value.
-
-
class
markets.models.
Outcome
(id, event, name, description, current_price, sell_offer, buy_offer)[source]¶
-
class
markets.models.
Position
(*args, **kwargs)[source]¶ A player’s position (opinion) about a given outcome as part of an order.
-
partial_complete
(pa, pb)[source]¶ Attempts to partially complete the given two positions.
In order to do so the positions must be of opposite type, compatible prices and on the same outcome.
The price at which the deal is completed is taken as the average of each player’s suggested price.
The amount of shares exchanged depends on the amounts defined by each position. In case one of the positions can be completed only partially, the amount of traded shares are subtracted from it and the trade is completed by creating a new Order which contains the fulfilled part of the transaction.
-