Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/parallel multi event simulation #687

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mzaja
Copy link
Contributor

@mzaja mzaja commented Aug 17, 2023

I have implemented a feature which allows parallel simulation of multiple events by assigning them execution groups via event_groups argument to the market filter. Execution groups replace event ids in the simulated framework so that any combination of events can be executed in parallel, not just one event at a time. However, if event_groups mapping is not provided, event group defaults to event id, so the legacy event processing behaviour remains unchanged.

Example usage here:
https://github.com/mzaja/flumine/blob/34136cbbaa31b4d27b18e38bf8cbd7f25bcc998a/docs/quickstart.md?plain=1#L219-L224

@liampauling
Copy link
Member

Any reason why you used this design

market_filter={"markets": [..], "event_processing": True, "event_groups": {"123": "A", "456": "A"}}

rather than:

market_filter={"markets": [..], "event_processing": True, "event_groups": {"A": ["123", "456"]}}

@mzaja
Copy link
Contributor Author

mzaja commented Sep 11, 2023

My original intention was to name the feature "event_aliases" so that, for example, a forecast event ID is converted to the event ID of win/place markets. However, I thought that "event_groups" might be more descriptive and less confusing to work with.

I see two advantages of the dict approach over the list one:

  1. It is not necessary to group all events. Say I want to simulate forecast, win and place markets in parallel. It is sufficient to map forecast event IDs to win/place event IDs. I do not need to explicitly map win/place event IDs to any group since groups default to event IDs if not provided. Think of this in term of "event ID alias is not provided so let's use real event ID".
  2. The list approach requires iterating over all groups to find which event IDs are aliased. The input (event ID) and the output (event group) are reversed, which is clunky to work with. With the current implementation, it is easy to check whether any given event should be grouped (key exists) or not (key does not exist).

@mzaja
Copy link
Contributor Author

mzaja commented Oct 5, 2023

Resolved merge conflicts with master.

@mzaja
Copy link
Contributor Author

mzaja commented May 14, 2024

@liampauling So what do you want to do regarding this PR? Do you want me to update the API as you proposed or do you want to accept it as it is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants