- Market clearing algorithms
- assume.markets.clearing_algorithms.all_or_nothing module
- assume.markets.clearing_algorithms.complex_clearing module
- assume.markets.clearing_algorithms.nodal_pricing module
- assume.markets.clearing_algorithms.simple module
- Module contents
- class assume.markets.base_market.MarketMechanism(marketconfig: MarketConfig)#
This class represents a market mechanism. It is different thant the MarketRole, in the way that the functionality is unrelated to mango. The MarketMechanism is embedded into the general MarketRole, which takes care of simulation concerns. In the Marketmechanism, all data needed for the clearing is present.
- clear(orderbook: list[assume.common.market_objects.Order], market_products: list[assume.common.market_objects.MarketProduct])#
- validate_orderbook(orderbook: list[assume.common.market_objects.Order], agent_tuple: tuple) None #
method to validate a given orderbook This is needed to check if all required fields for this mechanism are present
- class assume.markets.base_market.MarketRole(marketconfig: MarketConfig)#
This is the base class for all market roles. It implements the basic functionality of a market role, such as registering agents, clearing the market and sending the results to the database agent.
marketconfig (MarketConfig) – The configuration of the market
- async clear_market(market_products: list[assume.common.market_objects.MarketProduct])#
This method clears the market and sends the results to the database agent.
- handle_get_unmatched(content: dict, meta: MetaDict)#
A handler which sends the orderbook with unmatched orders to an agent. Allows to query a subset of the orderbook.
- handle_orderbook(content: OrderBookMessage, meta: MetaDict)#
This method handles incoming order book messages. It validates the order book and adds it to the list of all orders.
- handle_registration(content: RegistrationMessage, meta: MetaDict)#
This method handles incoming registration messages. It adds the sender of the message to the list of registered agents
content (dict) – The content of the message
meta (any) – The metadata of the message
- async opening()#
This method is called when the market opens. It sends an opening message to all registered agents, handles scheduling the clearing of the market and the next opening.
This method sets up the initial configuration and subscriptions for the market role. It sets the address and agent ID of the market config to match the current context.
It Defines three filter methods (accept_orderbook, accept_registration, and accept_get_unmatched) that serve as validation steps for different types of incoming messages.
Subscribes the role to handle incoming order book messages using the handle_orderbook method. Subscribes the role to handle incoming registration messages using the handle_registration method If the market configuration supports “get unmatched” functionality, subscribes the role to handle such messages using the handle_get_unmatched
Schedules the opening() method to run at the next opening time of the market.
- async store_market_results(market_meta)#
This method sends a message to the OutputRole to update data in the database
market_meta (any) – The metadata of the market