Skip to content

Commit

Permalink
Allow specifying of multiple CLOSE_TIME_UP_TO_N_DAYS for replicator (#92
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kongzii authored Apr 19, 2024
1 parent 95ff9d7 commit e2b426a
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions prediction_market_agent/agents/replicate_to_omen_agent/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ReplicateSettings(BaseSettings):

N_TO_REPLICATE: int
INITIAL_FUNDS: str
CLOSE_TIME_UP_TO_N_DAYS: int
CLOSE_TIME_UP_TO_N_DAYS: list[int]


class DeployableReplicateToOmenAgent(DeployableAgent):
Expand Down Expand Up @@ -56,25 +56,31 @@ def run(
logger.info("Redeeming funds from previously unfunded markets.")
redeem_from_all_user_positions(keys.bet_from_private_key)

close_time_before = utcnow() + timedelta(days=settings.CLOSE_TIME_UP_TO_N_DAYS)
initial_funds_per_market = xdai_type(settings.INITIAL_FUNDS)
for close_time_days in settings.CLOSE_TIME_UP_TO_N_DAYS:
close_time_before = utcnow() + timedelta(days=close_time_days)
initial_funds_per_market = xdai_type(settings.INITIAL_FUNDS)

logger.info(
f"Replicating from {MarketType.MANIFOLD} markets closing in {close_time_days} days."
)
omen_replicate_from_tx(
market_type=MarketType.MANIFOLD,
n_to_replicate=settings.N_TO_REPLICATE,
initial_funds=initial_funds_per_market,
from_private_key=keys.bet_from_private_key,
close_time_before=close_time_before,
auto_deposit=True,
)
logger.info(
f"Replicating from {MarketType.POLYMARKET} markets closing in {close_time_days} days."
)
omen_replicate_from_tx(
market_type=MarketType.POLYMARKET,
n_to_replicate=settings.N_TO_REPLICATE,
initial_funds=initial_funds_per_market,
from_private_key=keys.bet_from_private_key,
close_time_before=close_time_before,
auto_deposit=True,
)

logger.info(f"Replicating from {MarketType.MANIFOLD}.")
omen_replicate_from_tx(
market_type=MarketType.MANIFOLD,
n_to_replicate=settings.N_TO_REPLICATE,
initial_funds=initial_funds_per_market,
from_private_key=keys.bet_from_private_key,
close_time_before=close_time_before,
auto_deposit=True,
)
logger.info(f"Replicating from {MarketType.POLYMARKET}.")
omen_replicate_from_tx(
market_type=MarketType.POLYMARKET,
n_to_replicate=settings.N_TO_REPLICATE,
initial_funds=initial_funds_per_market,
from_private_key=keys.bet_from_private_key,
close_time_before=close_time_before,
auto_deposit=True,
)
logger.debug("Done.")

0 comments on commit e2b426a

Please sign in to comment.