EventABC#

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

event base class (ABC class).

It defines what the event is. All events should inherit this class.

abstract 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_cancel(simulator, cancel_log)[source]#

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

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

  • cancel_log (CancelLog) – cancel order submitted.

Return type:

None

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_after_order(simulator, order_log)[source]#

This method is hooked after order placements if you set the event hook. Please be careful that the order haven’t yet been executed if it could be executed immediately.

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

  • order_log (OrderLog) – order accepted.

Return type:

None

hooked_after_session(simulator, session)[source]#

This method is hooked after session ends if you set the event hook.

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

  • session (Session) – session to be ended.

Return type:

None

hooked_after_step_for_market(simulator, market)[source]#

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

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

  • market (Market) – market processed.

Return type:

None

hooked_before_cancel(simulator, cancel)[source]#

This method is hooked before order cancellations if you set the event hook. Please be careful that the cancel order haven’t yet been executed.

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

  • cancel (Cancel) – cancel order submitted.

Return type:

None

hooked_before_order(simulator, order)[source]#

This method is hooked before order placements if you set the event hook. Please be careful that the order haven’t yet been accepted by markets and it could be leakage of order information.

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

  • order (Order) – order accepting now.

Return type:

None

hooked_before_session(simulator, session)[source]#

This method is hooked before session beginnings if you set the event hook.

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

  • session (Session) – session to be started.

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.

Return type:

None

Returns:

None