Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion run_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 17 additions & 3 deletions trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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][
Expand All @@ -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"
Expand Down