Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Overrode market_buy() and market_sell() in NullMarketOperations so th…
Browse files Browse the repository at this point in the history
…ey didn't do anything but didn't error either.
  • Loading branch information
Geoff Taylor committed Mar 4, 2022
1 parent 4094e4a commit 24b5579
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mango/marketoperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}] »"""

0 comments on commit 24b5579

Please sign in to comment.