TradingHaltRule#

class pams.events.TradingHaltRule(event_id, prng, session, simulator, name)[source]#

A trading halt is a market regulation that suspends the trading of some assets.

When the one of targetMarkets violate halting line, all of them will be halted. If you want to halt them separately, please make event separately. The current implementation sets pams.market.Market.is_running() = false when the price changed beyond the prespecified threshold range.

hook_registration()[source]#

Define when this event should be hooked by simulator. This method is automatically hooked by simulator at the beginning of simulation. You must implement this.

Returns:

The list of event hook ( EventHook )

Return type:

List[EventHook]

hooked_after_execution(simulator, execution_log)[source]#

This method is hooked after order executions if you set the event hook.

Parameters:
Return type:

None

hooked_before_step_for_market(simulator, market)[source]#

This method is hooked at each step before market processing if you set the event hook.

Parameters:
  • simulator (Simulator) – simulator for reference.

  • market (Market) – market to be processed.

Return type:

None

setup(settings, *args, **kwargs)[source]#

event setup. Usually be called from simulator/runner automatically.

Parameters:

settings (Dict[str, Any]) – agent configuration. Usually, automatically set from json config of simulator. This must include the parameters “targetMarkets” and “triggerChangeRate”. This can include the parameters “haltingTimeLength” and “enabled”. The parameter “referenceMarket” is obsoleted.

Return type:

None

Returns:

None