nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.7k stars 400 forks source link

Fix order event object conversion #1649

Closed filipmacek closed 1 month ago

filipmacek commented 1 month ago

Pull Request

After the recent changes https://github.com/nautechsystems/nautilus_trader/commit/2526448a5d9b2783b78d6468de31a81b7af992ef in order event pyo3 conversion getter attribute was missing as you cannot use .getattr on function type_str. Instead of that we can use __name__ or __class__ attribute, and remove all type_str function from pyo3 classes

pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: PyErr
 { type: <class 'TypeError'>, 
value: TypeError("'builtin_function_or_method' object cannot be converted to 'PyString'"), 
traceback: None }