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

feat(FutureExchange): iterate the orders from the end makes the simulation run faster #430

Merged

Conversation

yakir4123
Copy link
Contributor

I've notice that there are some strategies that works very fast and some very slow while they use the same indicators.

The difference was if i change the orders every candle.
The base code iterate over all of the orders from the beginning to the end while personally i dont know why its needed, beacuse most of the orders is always at the end. On my strategy it makes this loop iterate O(n**2) on the number of candles!

Simulation of 6 months, timeframe "5m"
Simply search from the end make a major difference for such strategies.
Base code:
173s
image
where on_order_cancel is 45s and getitem (again probably because of this loop) another 38s
image

With this change:
60s
image

@saleh-mir saleh-mir merged commit 200085e into jesse-ai:master Apr 13, 2024
3 checks passed
@saleh-mir
Copy link
Member

If I can't believe this simple change had this much impact. Brilliant.

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.

None yet

2 participants