Skip to content

Commit

Permalink
Merge pull request #316 from valory-xyz/develop
Browse files Browse the repository at this point in the history
Fixing and improving reporting scripts
  • Loading branch information
Adamantios authored Jul 3, 2024
2 parents bdae127 + d004e47 commit 3027468
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class MarketAttribute(Enum):
"""Attribute"""

NUM_TRADES = "Num_trades"
NUM_VALID_TRADES = "Num_valid_trades"
WINNER_TRADES = "Winner_trades"
NUM_REDEEMED = "Num_redeemed"
NUM_INVALID_MARKET = "Num_invalid_market"
Expand Down Expand Up @@ -544,6 +545,16 @@ def _format_table(table: Dict[Any, Dict[Any, Any]]) -> str:
)
+ "\n"
)
table_str += (
f"{MarketAttribute.NUM_VALID_TRADES:<{column_width}}"
+ "".join(
[
f"{table[MarketAttribute.NUM_VALID_TRADES][c]:>{column_width}}"
for c in STATS_TABLE_COLS
]
)
+ "\n"
)
table_str += (
f"{MarketAttribute.WINNER_TRADES:<{column_width}}"
+ "".join(
Expand Down Expand Up @@ -767,10 +778,18 @@ 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"

if not is_invalid:
statistics_table[MarketAttribute.EARNINGS][

statistics_table[MarketAttribute.EARNINGS][
market_status
] += earnings

statistics_table[MarketAttribute.NUM_VALID_TRADES][
market_status
] = statistics_table[MarketAttribute.NUM_TRADES][
market_status
] - statistics_table[MarketAttribute.NUM_INVALID_MARKET][
market_status
]

if 0 < earnings < DUST_THRESHOLD:
output += "Earnings are dust.\n"
Expand Down

0 comments on commit 3027468

Please sign in to comment.