diff --git a/exchange/src/exchange/orders/level_tracking/level_quantity_tracker.cpp b/exchange/src/exchange/orders/level_tracking/level_quantity_tracker.cpp index 458e002d..7172e4c8 100644 --- a/exchange/src/exchange/orders/level_tracking/level_quantity_tracker.cpp +++ b/exchange/src/exchange/orders/level_tracking/level_quantity_tracker.cpp @@ -18,7 +18,7 @@ LevelQuantityTracker::report_quantity( // TODO: guarantee size checks if (levels.size() <= static_cast(price.get_underlying())) [[unlikely]] { auto new_size = - static_cast(static_cast(price.get_underlying()) * 1.5); + static_cast(static_cast(price.get_underlying()) * 1.5f); bid_levels_.resize(new_size); ask_levels_.resize(new_size); } diff --git a/exchange/src/wrapper/messaging/exchange_communicator.hpp b/exchange/src/wrapper/messaging/exchange_communicator.hpp index 518c792f..9d4e8ba9 100644 --- a/exchange/src/wrapper/messaging/exchange_communicator.hpp +++ b/exchange/src/wrapper/messaging/exchange_communicator.hpp @@ -12,10 +12,10 @@ namespace nutc::wrapper { using namespace nutc::common; using LimitOrderFunction = std::function; using MarketOrderFunction = - std::function; + std::function; using CancelOrderFunction = std::function; diff --git a/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp b/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp index 0de30f63..f5112bc5 100644 --- a/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp +++ b/exchange/src/wrapper/runtime/cpp/cpp_runtime.cpp @@ -104,8 +104,8 @@ CppRuntime::fire_on_trade_update( ) const { on_trade_update_func_( - strategy_object_, ticker, side, static_cast(quantity), - static_cast(price) + strategy_object_, ticker, side, static_cast(quantity), + static_cast(price) ); } @@ -115,8 +115,8 @@ CppRuntime::fire_on_orderbook_update( ) const { on_orderbook_update_func_( - strategy_object_, ticker, side, static_cast(quantity), - static_cast(price) + strategy_object_, ticker, side, static_cast(quantity), + static_cast(price) ); } @@ -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(quantity), + static_cast(price), static_cast(capital) ); } diff --git a/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp b/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp index 766c6a76..c90239a4 100644 --- a/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp +++ b/exchange/src/wrapper/runtime/cpp/cpp_runtime.hpp @@ -29,10 +29,10 @@ class CppRuntime : public Runtime { using Strategy = void; using InitFunc = Strategy* (*)(MarketOrderFunction, LimitOrderFunction, CancelOrderFunction); - using on_trade_update_func = void (*)(Strategy*, Ticker, Side, double, double); - using on_orderbook_update_func = void (*)(Strategy*, Ticker, Side, double, double); + using on_trade_update_func = void (*)(Strategy*, Ticker, Side, float, float); + using on_orderbook_update_func = void (*)(Strategy*, Ticker, Side, float, float); using on_account_update_func = - void (*)(Strategy*, Ticker, Side, double, double, double); + void (*)(Strategy*, Ticker, Side, float, float, float); on_trade_update_func on_trade_update_func_; on_orderbook_update_func on_orderbook_update_func_; diff --git a/exchange/src/wrapper/runtime/python/python_runtime.cpp b/exchange/src/wrapper/runtime/python/python_runtime.cpp index c53f649a..25585726 100644 --- a/exchange/src/wrapper/runtime/python/python_runtime.cpp +++ b/exchange/src/wrapper/runtime/python/python_runtime.cpp @@ -18,7 +18,7 @@ PyRuntime::fire_on_trade_update( { try { py::globals()["strategy"].attr("on_trade_update")( - ticker, side, static_cast(quantity), static_cast(price) + ticker, side, static_cast(quantity), static_cast(price) ); } catch (const py::error_already_set& err) { std::cerr << err.what() << "\n"; @@ -32,7 +32,7 @@ PyRuntime::fire_on_orderbook_update( { try { py::globals()["strategy"].attr("on_orderbook_update")( - ticker, side, static_cast(quantity), static_cast(price) + ticker, side, static_cast(quantity), static_cast(price) ); } catch (const py::error_already_set& err) { std::cerr << err.what() << "\n"; @@ -47,8 +47,8 @@ PyRuntime::fire_on_account_update( { try { py::globals()["strategy"].attr("on_account_update")( - ticker, side, static_cast(quantity), static_cast(price), - static_cast(capital) + ticker, side, static_cast(quantity), static_cast(price), + static_cast(capital) ); } catch (const py::error_already_set& err) { std::cerr << err.what() << "\n"; diff --git a/exchange/template.cpp b/exchange/template.cpp index 3603b028..a9d02fab 100644 --- a/exchange/template.cpp +++ b/exchange/template.cpp @@ -6,8 +6,8 @@ #include -using PlaceMarketOrder = std::function; -using PlaceLimitOrder = std::function; +using PlaceMarketOrder = std::function; +using PlaceLimitOrder = std::function; using CancelOrder = std::function; static PlaceMarketOrder s_place_market_order; @@ -15,13 +15,13 @@ static PlaceLimitOrder s_place_limit_order; static CancelOrder s_cancel_order; bool -place_market_order(Side side, Ticker ticker, double quantity) +place_market_order(Side side, Ticker ticker, float quantity) { return s_place_market_order(side, ticker, quantity); } std::int64_t -place_limit_order(Side side, Ticker ticker, double quantity, double price, bool ioc) +place_limit_order(Side side, Ticker ticker, float quantity, float price, bool ioc) { return s_place_limit_order(side, ticker, quantity, price, ioc); } @@ -47,7 +47,7 @@ init( void on_trade_update( - Strategy* strategy, Ticker ticker, Side side, double quantity, double price + Strategy* strategy, Ticker ticker, Side side, float quantity, float price ) { strategy->on_trade_update(ticker, side, quantity, price); @@ -55,7 +55,7 @@ on_trade_update( void on_orderbook_update( - Strategy* strategy, Ticker ticker, Side side, double quantity, double price + Strategy* strategy, Ticker ticker, Side side, float quantity, float price ) { strategy->on_orderbook_update(ticker, side, quantity, price); @@ -63,8 +63,8 @@ on_orderbook_update( void on_account_update( - Strategy* strategy, Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Strategy* strategy, Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) { strategy->on_account_update(ticker, side, price, quantity, capital_remaining); diff --git a/exchange/test/src/integration/test_algos/cpp/buy_eth.hpp b/exchange/test/src/integration/test_algos/cpp/buy_eth.hpp index df0f4510..051c56c5 100644 --- a/exchange/test/src/integration/test_algos/cpp/buy_eth.hpp +++ b/exchange/test/src/integration/test_algos/cpp/buy_eth.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -72,7 +72,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -86,8 +86,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/buy_market_order_1000.hpp b/exchange/test/src/integration/test_algos/cpp/buy_market_order_1000.hpp index 7843a4e3..a279c4f1 100644 --- a/exchange/test/src/integration/test_algos/cpp/buy_market_order_1000.hpp +++ b/exchange/test/src/integration/test_algos/cpp/buy_market_order_1000.hpp @@ -18,7 +18,7 @@ enum class Ticker : std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * * @return true if order succeeded, false if order failed due to rate limiting */ -bool place_market_order(Side side, Ticker ticker, double quantity); +bool place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -36,7 +36,7 @@ bool place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, bool ioc = false + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); bool cancel_order(Ticker ticker, std::int64_t order_id); @@ -56,7 +56,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) { if (ticker == Ticker::ETH && price <= 101 && price >= 99 && quantity == 5) { place_limit_order(Side::buy, Ticker::BTC, 1, 100); @@ -74,7 +74,7 @@ class Strategy { * @param quantity Volume placed into orderbook */ void - on_orderbook_update(Ticker ticker, Side side, double quantity, double price) + on_orderbook_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -88,8 +88,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/buy_tsla_at_100.hpp b/exchange/test/src/integration/test_algos/cpp/buy_tsla_at_100.hpp index 14bc03b0..c61f934b 100644 --- a/exchange/test/src/integration/test_algos/cpp/buy_tsla_at_100.hpp +++ b/exchange/test/src/integration/test_algos/cpp/buy_tsla_at_100.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -72,7 +72,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) { if (ticker == Ticker::ETH && quantity < 101 && quantity > 99) { @@ -90,8 +90,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_account.hpp b/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_account.hpp index a9c559a7..02b714ab 100644 --- a/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_account.hpp +++ b/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_account.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -72,7 +72,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -86,8 +86,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) { if (ticker == Ticker::ETH && quantity >= 10) diff --git a/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_trade.hpp b/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_trade.hpp index b05a5551..0f88e86c 100644 --- a/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_trade.hpp +++ b/exchange/test/src/integration/test_algos/cpp/buy_tsla_on_trade.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) { if (ticker == Ticker::ETH && quantity >= 10) place_limit_order(Side::buy, Ticker::BTC, 1, 100); @@ -75,7 +75,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -89,8 +89,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/cancel_limit_order.hpp b/exchange/test/src/integration/test_algos/cpp/cancel_limit_order.hpp index a450e6e1..be640b84 100644 --- a/exchange/test/src/integration/test_algos/cpp/cancel_limit_order.hpp +++ b/exchange/test/src/integration/test_algos/cpp/cancel_limit_order.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -62,7 +62,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -76,7 +76,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -90,8 +90,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/confirm_1000.hpp b/exchange/test/src/integration/test_algos/cpp/confirm_1000.hpp index aea03159..c5e6e0c3 100644 --- a/exchange/test/src/integration/test_algos/cpp/confirm_1000.hpp +++ b/exchange/test/src/integration/test_algos/cpp/confirm_1000.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -60,7 +60,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -74,7 +74,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) { if (ticker == Ticker::ETH && price >= 0.0) @@ -93,8 +93,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/partial_cancel_limit_order.hpp b/exchange/test/src/integration/test_algos/cpp/partial_cancel_limit_order.hpp index ea4ec112..53a968ad 100644 --- a/exchange/test/src/integration/test_algos/cpp/partial_cancel_limit_order.hpp +++ b/exchange/test/src/integration/test_algos/cpp/partial_cancel_limit_order.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -63,7 +63,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -77,7 +77,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -91,8 +91,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/sell_market_order_1000.hpp b/exchange/test/src/integration/test_algos/cpp/sell_market_order_1000.hpp index 3ee2dc02..29182a17 100644 --- a/exchange/test/src/integration/test_algos/cpp/sell_market_order_1000.hpp +++ b/exchange/test/src/integration/test_algos/cpp/sell_market_order_1000.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) { if (ticker == Ticker::ETH && price <= 101 && price >= 99 && quantity == 1) { place_limit_order(Side::buy, Ticker::BTC, 1, 100); @@ -76,7 +76,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -90,8 +90,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) {} }; diff --git a/exchange/test/src/integration/test_algos/cpp/sell_tsla_on_account.hpp b/exchange/test/src/integration/test_algos/cpp/sell_tsla_on_account.hpp index 82ae88ce..4a651827 100644 --- a/exchange/test/src/integration/test_algos/cpp/sell_tsla_on_account.hpp +++ b/exchange/test/src/integration/test_algos/cpp/sell_tsla_on_account.hpp @@ -19,7 +19,7 @@ enum class Ticker: std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * @return true if order succeeded, false if order failed due to rate limiting */ bool -place_market_order(Side side, Ticker ticker, double quantity); +place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -37,7 +37,7 @@ place_market_order(Side side, Ticker ticker, double quantity); * @return true if order succeeded, false if order failed due to rate limiting */ std::int64_t place_limit_order( - Side side, Ticker ticker, double quantity, double price, + Side side, Ticker ticker, float quantity, float price, bool ioc = false ); @@ -58,7 +58,7 @@ class Strategy { * @quantity quantity Volume traded */ void - on_trade_update(Ticker ticker, Side side, double quantity, double price) + on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** @@ -72,7 +72,7 @@ class Strategy { */ void on_orderbook_update( - Ticker ticker, Side side, double quantity, double price + Ticker ticker, Side side, float quantity, float price ) {} @@ -86,8 +86,8 @@ class Strategy { */ void on_account_update( - Ticker ticker, Side side, double price, double quantity, - double capital_remaining + Ticker ticker, Side side, float price, float quantity, + float capital_remaining ) { if (ticker == Ticker::ETH && quantity >= 10) diff --git a/web/public/template.hpp b/web/public/template.hpp index 8bfd1eb7..748e5b36 100644 --- a/web/public/template.hpp +++ b/web/public/template.hpp @@ -3,7 +3,7 @@ #include enum class Side { buy = 0, sell = 1 }; -enum class Ticker { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT +enum class Ticker : std::uint8_t { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT /** * Place a market order @@ -18,7 +18,7 @@ enum class Ticker { ETH = 0, BTC = 1, LTC = 2 }; // NOLINT * * @return true if order succeeded, false if order failed due to rate limiting */ -bool place_market_order(Side side, Ticker ticker, double quantity); +bool place_market_order(Side side, Ticker ticker, float quantity); /** * Place a limit order @@ -35,8 +35,8 @@ bool place_market_order(Side side, Ticker ticker, double quantity); * * @return true if order succeeded, false if order failed due to rate limiting */ -std::int64_t place_limit_order(Side side, Ticker ticker, double quantity, - double price, bool ioc = false); +std::int64_t place_limit_order(Side side, Ticker ticker, float quantity, + float price, bool ioc = false); bool cancel_order(Ticker ticker, std::int64_t order_id); @@ -56,8 +56,7 @@ class Strategy { * @param price Price that trade was executed at * @quantity quantity Volume traded */ - void on_trade_update(Ticker ticker, Side side, double quantity, - double price) {} + void on_trade_update(Ticker ticker, Side side, float quantity, float price) {} /** * Called whenever the orderbook changes. This could be because of a trade, or @@ -68,8 +67,8 @@ class Strategy { * @param price Price of orderbook that has an update * @param quantity Volume placed into orderbook */ - void on_orderbook_update(Ticker ticker, Side side, double quantity, - double price) {} + void on_orderbook_update(Ticker ticker, Side side, float quantity, + float price) {} /** * Called whenever one of your orders is filled. @@ -79,6 +78,6 @@ class Strategy { * @param price Price that order was fulfilled at * @param quantity Amount of capital after fulfilling order */ - void on_account_update(Ticker ticker, Side side, double price, - double quantity, double capital_remaining) {} + void on_account_update(Ticker ticker, Side side, float price, float quantity, + float capital_remaining) {} };