Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-verify that buy trades wouldn't cause guaranted loss #488

Merged
merged 7 commits into from
Oct 17, 2024
Merged
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion prediction_market_agent_tooling/deploy/betting_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ def calculate_trades(
) -> list[Trade]:
direction = self.calculate_direction(market.current_p_yes, answer.p_yes)

# Don't bet `bet_amount` if it's less than liquidity, because that means just losing money instantly.
kongzii marked this conversation as resolved.
Show resolved Hide resolved
bet_amount = min(self.bet_amount, market.get_liquidity().amount)
kongzii marked this conversation as resolved.
Show resolved Hide resolved
amounts = {
market.get_outcome_str_from_bool(direction): TokenAmount(
amount=self.bet_amount,
amount=bet_amount,
currency=market.currency,
),
}
Expand Down
Loading