Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Merged
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
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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Num trades on valid markets ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, on markets that were not declared invalid

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