Skip to content

Commit

Permalink
(feat) smart round prices in market info for amm arb strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
vic-en committed Apr 3, 2021
1 parent 37df326 commit e627495
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hummingbot/strategy/amm_arb/amm_arb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from hummingbot.strategy.strategy_py_base import StrategyPyBase
from hummingbot.connector.connector_base import ConnectorBase
from hummingbot.client.settings import ETH_WALLET_CONNECTORS
from hummingbot.client.performance import smart_round
from hummingbot.connector.connector.uniswap.uniswap_connector import UniswapConnector

from .utils import create_arb_proposals, ArbProposal
Expand Down Expand Up @@ -255,9 +256,9 @@ async def format_status(self) -> str:
sell_price = await market.get_quote_price(trading_pair, False, self._order_amount)

# check for unavailable price data
buy_price = Decimal(str(buy_price)) if buy_price is not None else '-'
sell_price = Decimal(str(sell_price)) if sell_price is not None else '-'
mid_price = ((buy_price + sell_price) / 2) if '-' not in [buy_price, sell_price] else '-'
buy_price = smart_round(Decimal(str(buy_price)), 8) if buy_price is not None else '-'
sell_price = smart_round(Decimal(str(sell_price)), 8) if sell_price is not None else '-'
mid_price = smart_round(((buy_price + sell_price) / 2), 8) if '-' not in [buy_price, sell_price] else '-'

data.append([
market.display_name,
Expand Down

0 comments on commit e627495

Please sign in to comment.