diff --git a/agent.py b/agent.py deleted file mode 100644 index 0b31ef26..00000000 --- a/agent.py +++ /dev/null @@ -1,61 +0,0 @@ -import typer -import time -import logging -from decimal import Decimal -from datetime import timedelta - -import prediction_market_agent as pma -from prediction_market_agent.tools.gtypes import xDai, Mana -from prediction_market_agent.markets.all_markets import ( - MarketType, - get_bet_amount, - get_binary_markets, - place_bet, -) -from prediction_market_agent.agents.abstract import AbstractAgent -from prediction_market_agent.agents.all_agents import AgentType, get_agent - - -def main( - market_type: MarketType = MarketType.MANIFOLD, - agent_type: AgentType = AgentType.ALWAYS_YES, - sleep_time: int = timedelta(days=1).seconds, -) -> None: - """ - Start the agent as a continuous process. Picks a market and answers it, forever and ever. - """ - agent: AbstractAgent = get_agent(agent_type) - keys = pma.utils.get_keys() - - while True: - # TODO: Agent needs to keep track of the questions it has answered. It should skip them or re-evaluate. - available_markets = [ - x.to_agent_market() for x in get_binary_markets(market_type) - ] - logging.info( - f"Found {len(available_markets)} markets: {[m.question for m in available_markets]}" - ) - - agent_market = agent.pick_market(available_markets) - logging.info(f"Picked market [{agent_market.id}]: {agent_market.question}") - answer = agent.answer_binary_market(agent_market) - logging.info(f"Answered market [{agent_market.id}]: {answer}") - - # TODO: Calculate the amount to bet based on the confidence of the answer. - amount = Decimal("0.1") - logging.info(f"Placing bet of {amount} on market [{agent_market.id}]: {answer}") - - place_bet( - market=agent_market.original_market, - amount=get_bet_amount(amount, market_type), - outcome=answer, - keys=keys, - omen_auto_deposit=True, - ) - - logging.info(f"Sleeping for {timedelta(seconds=sleep_time)}...") - time.sleep(sleep_time) - - -if __name__ == "__main__": - typer.run(main) diff --git a/prediction_market_agent/deploy/deploy.py b/prediction_market_agent/deploy/deploy.py index 0bbbd6d5..fcf9b6a2 100644 --- a/prediction_market_agent/deploy/deploy.py +++ b/prediction_market_agent/deploy/deploy.py @@ -33,9 +33,7 @@ class DeploymentType(str, Enum): class DeployableAgent(BaseModel): def pick_markets(self, markets: list[AgentMarket]) -> list[AgentMarket]: - if len(markets) > 1: - return markets[:1] - return markets + return markets[:1] def answer_binary_market(self, market: AgentMarket) -> bool: raise NotImplementedError("This method should be implemented by the subclass") diff --git a/prediction_market_agent/deploy/utils.py b/prediction_market_agent/deploy/utils.py index 48d027c8..115dc8ce 100644 --- a/prediction_market_agent/deploy/utils.py +++ b/prediction_market_agent/deploy/utils.py @@ -122,7 +122,3 @@ def get_gcp_function(fname: str) -> Function: def gcp_function_is_active(fname: str) -> bool: return get_gcp_function(fname).state == Function.State.ACTIVE - - -def convert_seconds_to_cron_string(seconds: int) -> str: - return f"*/* * * * *"