Skip to content

Commit

Permalink
Simple fix (#621)
Browse files Browse the repository at this point in the history
* Simple fix

* Missing lower
  • Loading branch information
gabrielfior authored Dec 30, 2024
1 parent 25bded4 commit f9b4a85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions prediction_market_agent/agents/arbitrage_agent/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions prediction_market_agent/agents/arbitrage_agent/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f9b4a85

Please sign in to comment.