-
Notifications
You must be signed in to change notification settings - Fork 11
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
Python Frontend #17
Comments
@calumrussell What do you think about doing this with pyo3? |
Yes, I was using pyo3 as the entrypoint in an application using alator (i.e. you call a python script to run the backtest) and it works. The problem is that you have copies at the boundary between Python and Rust so there was a performance hit. One way to get around this could be to implement the I decided to abandon this path because I wanted to write a strategy in Python and then run it in Rust, as opposed to just adding an entrypoint. This is possible and would only require building implementations around pyo3 types but it adds a layer of complexity because pyo3 types aren't native. I am not sure what the performance implications would be (again, Arrow may also be reasonable as it is zero-copy). So I decided to go for a complete split of the components - #22 - so you could have a Python trading strategy passing messages to a broker running in Rust with complete separation. This will hurt performance too but with a justifiable improvement in flexibility. This is my current plan for this issue. |
Hmm. I believe, if past experience serves me correctly, that zero copy interopt between rust <-> python is possible, just a lot of work. I'll see if I've got some code that I can share re that, |
Yes, you can do that by implementing a As an example:
The reason why I am not adding to this library is because I have been moving towards needing a strategy written in Python as well, which is possible (I think) but more complex. So I have decided to go in a different direction. |
Got it. |
I am using this package within a Python app that, at the moment, is getting bound somewhere else into Python. Look at moving some of these bindings into this package so backtests can be run from Python.
Key feature add would be to see whether a strategy could be created in Python and then runs in Rust.
The text was updated successfully, but these errors were encountered: