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

Allow specifying of multiple CLOSE_TIME_UP_TO_N_DAYS for replicator #92

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Changes from all commits
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
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]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can force to replicate markets that will close soon, but at the same time these that will close in a year or so



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.")
Loading