Skip to content

Commit

Permalink
Merge pull request #71 from masanorihirano/release/0.0.15
Browse files Browse the repository at this point in the history
Release/0.0.15
  • Loading branch information
masanorihirano authored Apr 23, 2023
2 parents 3062877 + fe3cae2 commit a83f988
Show file tree
Hide file tree
Showing 7 changed files with 505 additions and 7 deletions.
4 changes: 3 additions & 1 deletion pams/order_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def cancel(self, cancel: Cancel) -> None:
"""
cancel.order.is_canceled = True
cancel.placed_at = self.time
self._remove(cancel.order)
if cancel.order in self.priority_queue:
# in case that order is executed before canceling.
self._remove(cancel.order)

def get_best_order(self) -> Optional[Order]:
"""get the order with the highest priority.
Expand Down
4 changes: 2 additions & 2 deletions pams/runners/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def _handle_orders(
log_: CancelLog = market._cancel_order(cancel=order)
agent = self.simulator.id2agent[order.order.agent_id]
agent.canceled_order(log=log_)
self.simulator._trigger_event_after_cancel(cancel_log=order)
self.simulator._trigger_event_after_cancel(cancel_log=log_)
else:
raise NotImplementedError
if session.with_order_execution:
Expand Down Expand Up @@ -517,7 +517,7 @@ def _handle_orders(
log_ = market._cancel_order(cancel=order)
agent = self.simulator.id2agent[order.order.agent_id]
agent.canceled_order(log=log_)
self.simulator._trigger_event_after_cancel(cancel_log=order)
self.simulator._trigger_event_after_cancel(cancel_log=log_)
else:
raise NotImplementedError
if session.with_order_execution:
Expand Down
2 changes: 1 addition & 1 deletion pams/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def setup(self, settings: Dict[str, Any], *args, **kwargs) -> None: # type: ign
# TODO: check malOrders + maxHighFrequencyOrders >= 1
if "highFrequencySubmitRate" in settings:
# TODO: check non-negative
self.max_high_frequency_orders = settings["highFrequencySubmitRate"]
self.high_frequency_submission_rate = settings["highFrequencySubmitRate"]
if "hifreqSubmitRate" in settings:
raise ValueError(
"hifreqSubmitRate is replaced to highFrequencySubmitRate in pams. Please delete it."
Expand Down
2 changes: 1 addition & 1 deletion pams/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def _trigger_event_after_cancel(self, cancel_log: "CancelLog") -> None: # type:
Returns:
None
"""
time: int = cancel_log.time
time: int = cancel_log.cancel_time
event_hooks = self.events_dict["cancel_after"]
target_event_hooks: List[EventHook] = []
if None in event_hooks:
Expand Down
2 changes: 1 addition & 1 deletion pams/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.14"
__version__ = "0.0.15"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pams"
version = "0.0.14"
version = "0.0.15"
description = "PAMS: Platform for Artificial Market Simulations"
authors = ["Masanori HIRANO <[email protected]>"]
license = "MIT"
Expand Down
Loading

0 comments on commit a83f988

Please sign in to comment.