diff --git a/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp b/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp index 65dfca9d..de8511fd 100644 --- a/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp +++ b/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp @@ -100,7 +100,7 @@ CppRuntime::~CppRuntime() void CppRuntime::fire_on_trade_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const { on_trade_update_func_( @@ -111,7 +111,7 @@ CppRuntime::fire_on_trade_update( void CppRuntime::fire_on_orderbook_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const { on_orderbook_update_func_( @@ -127,8 +127,8 @@ CppRuntime::fire_on_account_update( ) const { on_account_update_func_( - strategy_object_, ticker, side, static_cast(quantity), - static_cast(price), static_cast(capital) + strategy_object_, ticker, side, static_cast(price), + static_cast(quantity), static_cast(capital) ); } diff --git a/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp b/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp index 8869cb2d..3802cf5c 100644 --- a/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp +++ b/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp @@ -15,11 +15,11 @@ class CppRuntime : public Runtime { private: void fire_on_trade_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const override; void fire_on_orderbook_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const override; void fire_on_account_update( diff --git a/exchange/src/wrapper/runtime/python/python_runtime.cpp b/exchange/src/wrapper/runtime/python/python_runtime.cpp index 2c7b7af1..24698172 100644 --- a/exchange/src/wrapper/runtime/python/python_runtime.cpp +++ b/exchange/src/wrapper/runtime/python/python_runtime.cpp @@ -5,15 +5,13 @@ #include #include -#include - namespace nutc::wrapper { namespace py = pybind11; void PyRuntime::fire_on_trade_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const { try { @@ -28,7 +26,7 @@ PyRuntime::fire_on_trade_update( void PyRuntime::fire_on_orderbook_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const { try { @@ -49,7 +47,7 @@ PyRuntime::fire_on_account_update( { try { py::globals()["strategy"].attr("on_account_update")( - ticker, side, static_cast(quantity), static_cast(price), + ticker, side, static_cast(price), static_cast(quantity), static_cast(capital) ); } catch (const py::error_already_set& err) { diff --git a/exchange/src/wrapper/runtime/python/python_runtime.hpp b/exchange/src/wrapper/runtime/python/python_runtime.hpp index 8e5e7b20..7d7cb3fc 100644 --- a/exchange/src/wrapper/runtime/python/python_runtime.hpp +++ b/exchange/src/wrapper/runtime/python/python_runtime.hpp @@ -28,11 +28,11 @@ class PyRuntime : public Runtime { pybind11::scoped_interpreter guard_; void fire_on_trade_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const override; void fire_on_orderbook_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const override; void fire_on_account_update( diff --git a/exchange/src/wrapper/runtime/runtime.cpp b/exchange/src/wrapper/runtime/runtime.cpp index dec59b09..cd36b083 100644 --- a/exchange/src/wrapper/runtime/runtime.cpp +++ b/exchange/src/wrapper/runtime/runtime.cpp @@ -14,18 +14,18 @@ void Runtime::process_message(tick_update&& tick_update) { std::ranges::for_each(tick_update.ob_updates, [&](const position& u) { - fire_on_orderbook_update(u.ticker, u.side, u.price, u.quantity); + fire_on_orderbook_update(u.ticker, u.side, u.quantity, u.price); }); std::ranges::for_each(tick_update.matches, [&](const match& m) { const auto& p = m.position; - fire_on_trade_update(p.ticker, p.side, p.price, p.quantity); + fire_on_trade_update(p.ticker, p.side, p.quantity, p.price); - if (m.buyer_id == trader_id_) { + if (m.buyer_id == trader_id_) [[unlikely]] { fire_on_account_update( p.ticker, p.side, p.price, p.quantity, m.buyer_capital ); } - if (m.seller_id == trader_id_) { + if (m.seller_id == trader_id_) [[unlikely]] { fire_on_account_update( p.ticker, p.side, p.price, p.quantity, m.seller_capital ); diff --git a/exchange/src/wrapper/runtime/runtime.hpp b/exchange/src/wrapper/runtime/runtime.hpp index 7e210bf7..cf1258b3 100644 --- a/exchange/src/wrapper/runtime/runtime.hpp +++ b/exchange/src/wrapper/runtime/runtime.hpp @@ -28,10 +28,10 @@ class Runtime { {} virtual void fire_on_trade_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const = 0; virtual void fire_on_orderbook_update( - Ticker ticker, Side side, decimal_price price, decimal_quantity quantity + Ticker ticker, Side side, decimal_quantity quantity, decimal_price price ) const = 0; virtual void fire_on_account_update( Ticker ticker, Side side, decimal_price price, decimal_quantity quantity,