Skip to content

Commit

Permalink
Remove timestamp check when matching bets with traces (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
evangriffiths authored Sep 20, 2024
1 parent b7168ae commit 5fe7dfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 6 additions & 3 deletions examples/monitor/match_bets_with_langfuse_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if __name__ == "__main__":
api_keys = APIKeys()
assert api_keys.bet_from_address == Web3.to_checksum_address(
"0xe7aa88a1d044e5c987ecce55ae8d2b562a41b72d" # prophetgpt4
"0xA8eFa5bb5C6ad476c9E0377dbF66cC41CB6D5bdD" # prophet_gpt4_final
)
start_time = datetime(2024, 9, 13)
langfuse = Langfuse(
Expand Down Expand Up @@ -44,7 +44,6 @@
start_time=start_time,
end_time=None,
)
print(f"All bets: {len(bets)}")

# All bets should have a trace, but not all traces should have a bet
# (e.g. if all markets are deemed unpredictable), so iterate over bets
Expand All @@ -54,4 +53,8 @@
if trace:
bets_with_traces.append(ResolvedBetWithTrace(bet=bet, trace=trace))

print(f"Matched bets with traces: {len(bets_with_traces)}")
print(f"Number of bets since {start_time}: {len(bets_with_traces)}")
if len(bets_with_traces) != len(bets):
raise ValueError(
f"{len(bets) - len(bets_with_traces)} bets do not have a corresponding trace"
)
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,5 @@ def get_trace_for_bet(
add_utc_timezone_validator(bet.created_time),
[t.timestamp for t in traces_for_bet],
)
# Sanity check - the trace should be after the bet
if traces_for_bet[closest_trace_index].timestamp < add_utc_timezone_validator(
bet.created_time
):
return None

return traces_for_bet[closest_trace_index]

0 comments on commit 5fe7dfd

Please sign in to comment.