diff --git a/run_service.sh b/run_service.sh index 363dbc54..37a00803 100755 --- a/run_service.sh +++ b/run_service.sh @@ -611,7 +611,7 @@ directory="trader" service_repo=https://github.com/$org_name/$directory.git # This is a tested version that works well. # Feel free to replace this with a different version of the repo, but be careful as there might be breaking changes -service_version="v0.16.1" +service_version="v0.16.2" # Define constants for on-chain interaction gnosis_chain_id=100 diff --git a/trades.py b/trades.py index 0005f4ab..3da58e28 100644 --- a/trades.py +++ b/trades.py @@ -171,6 +171,7 @@ class MarketAttribute(Enum): NUM_TRADES = "Num_trades" WINNER_TRADES = "Winner_trades" NUM_REDEEMED = "Num_redeemed" + NUM_INVALID_MARKET = "Num_invalid_market" INVESTMENT = "Investment" FEES = "Fees" MECH_CALLS = "Mech_calls" @@ -515,7 +516,7 @@ def _get_market_state(market: Dict[str, Any]) -> MarketState: def _format_table(table: Dict[Any, Dict[Any, Any]]) -> str: - column_width = 14 + column_width = 18 table_str = " " * column_width @@ -555,6 +556,16 @@ def _format_table(table: Dict[Any, Dict[Any, Any]]) -> str: ) + "\n" ) + table_str += ( + f"{MarketAttribute.NUM_INVALID_MARKET:<{column_width}}" + + "".join( + [ + f"{table[MarketAttribute.NUM_INVALID_MARKET][c]:>{column_width}}" + for c in STATS_TABLE_COLS + ] + ) + + "\n" + ) table_str += ( f"{MarketAttribute.MECH_CALLS:<{column_width}}" + "".join( @@ -722,7 +733,7 @@ def parse_user( # pylint: disable=too-many-locals,too-many-statements output += f" Earnings: {wei_to_xdai(earnings)}\n" redeemed = _is_redeemed(user_json, fpmmTrade) if redeemed: - statistics_table[MarketAttribute.NUM_REDEEMED][ + statistics_table[MarketAttribute.NUM_INVALID_MARKET][ market_status ] += 1 statistics_table[MarketAttribute.REDEMPTIONS][ @@ -748,7 +759,10 @@ def parse_user( # pylint: disable=too-many-locals,too-many-statements earnings = 0 output += f" Final answer: {fpmm['outcomes'][current_answer]!r} - The trade was for the loser answer.\n" - statistics_table[MarketAttribute.EARNINGS][market_status] += earnings + if not is_invalid: + statistics_table[MarketAttribute.EARNINGS][ + market_status + ] += earnings if 0 < earnings < DUST_THRESHOLD: output += "Earnings are dust.\n"