From 24b5579574aaa588a2fa52ad1d8d61a2f2e1b41b Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Fri, 4 Mar 2022 17:22:54 +0000 Subject: [PATCH] Overrode market_buy() and market_sell() in NullMarketOperations so they didn't do anything but didn't error either. --- mango/marketoperations.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mango/marketoperations.py b/mango/marketoperations.py index 9cdcb0a..023995e 100644 --- a/mango/marketoperations.py +++ b/mango/marketoperations.py @@ -289,5 +289,21 @@ def create_openorders(self) -> PublicKey: def ensure_openorders(self) -> PublicKey: return SYSTEM_PROGRAM_ADDRESS + def market_buy( + self, quantity: Decimal, max_slippage: Decimal + ) -> typing.Sequence[str]: + self._logger.info( + f"[Dry Run] Not market buying {quantity} with max slippage {max_slippage}." + ) + return [] + + def market_sell( + self, quantity: Decimal, max_slippage: Decimal + ) -> typing.Sequence[str]: + self._logger.info( + f"[Dry Run] Not market selling {quantity} with max slippage {max_slippage}." + ) + return [] + def __str__(self) -> str: return f"""« NullMarketOperations [{self.market.fully_qualified_symbol}] »"""