diff --git a/prediction_market_agent/agents/arbitrage_agent/data_models.py b/prediction_market_agent/agents/arbitrage_agent/data_models.py index 06f143f7..4ef91682 100644 --- a/prediction_market_agent/agents/arbitrage_agent/data_models.py +++ b/prediction_market_agent/agents/arbitrage_agent/data_models.py @@ -24,6 +24,10 @@ class CorrelatedMarketPair(BaseModel): def __str__(self) -> str: return f"main_market {self.main_market.question} related_market_question {self.related_market.question} potential_profit_per_unit {self.potential_profit_per_bet_unit()}" + @property + def main_market_and_related_market_equal(self) -> bool: + return self.main_market.id.lower() == self.related_market.id.lower() + def potential_profit_per_bet_unit(self) -> float: """ Calculate potential profit per bet unit based on high positive market correlation. diff --git a/prediction_market_agent/agents/arbitrage_agent/deploy.py b/prediction_market_agent/agents/arbitrage_agent/deploy.py index 201a0043..7b174a82 100644 --- a/prediction_market_agent/agents/arbitrage_agent/deploy.py +++ b/prediction_market_agent/agents/arbitrage_agent/deploy.py @@ -125,6 +125,11 @@ def get_correlated_markets(self, market: AgentMarket) -> list[CorrelatedMarketPa print(f"Fetched {len(omen_markets)} related markets for market {market.id}") for related_market in omen_markets: + if related_market.id.lower() == market.id.lower(): + logger.info( + f"Skipping related market {related_market.id} since same market as {market.id}" + ) + continue result: Correlation = self.chain.invoke( { "main_market_question": market, @@ -185,6 +190,11 @@ def build_trades( trades = [] correlated_markets = self.get_correlated_markets(market=market) for pair in correlated_markets: + if pair.main_market_and_related_market_equal: + logger.info( + "Skipping market pair since related- and main market are the same." + ) + continue # We want to profit at least 0.5% per market (value chosen as initial baseline). if pair.potential_profit_per_bet_unit() > 0.005: trades_for_pair = self.build_trades_for_correlated_markets(pair)