-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from gnosis/evan/monitor-omen
Support monitoring for deployed Omen agents
- Loading branch information
Showing
7 changed files
with
92 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
from datetime import datetime | ||
|
||
from web3 import Web3 | ||
|
||
from prediction_market_agent_tooling.gtypes import ChecksumAddress | ||
from prediction_market_agent_tooling.markets.data_models import ResolvedBet | ||
from prediction_market_agent_tooling.markets.omen.omen import get_resolved_bets | ||
from prediction_market_agent_tooling.monitor.monitor import DeployedAgent | ||
from prediction_market_agent_tooling.markets.omen.omen import get_bets | ||
from prediction_market_agent_tooling.monitor.monitor import ( | ||
DeployedAgent, | ||
MonitorSettings, | ||
) | ||
|
||
|
||
class DeployedOmenAgent(DeployedAgent): | ||
wallet_address: ChecksumAddress | ||
|
||
def get_resolved_bets(self) -> list[ResolvedBet]: | ||
bets = get_resolved_bets( | ||
bets = get_bets( | ||
better_address=self.wallet_address, | ||
start_time=self.start_time, | ||
end_time=None, | ||
) | ||
return [b.to_generic_resolved_bet() for b in bets] | ||
return [b.to_generic_resolved_bet() for b in bets if b.fpmm.is_resolved] | ||
|
||
@staticmethod | ||
def from_monitor_settings( | ||
settings: MonitorSettings, start_time: datetime | ||
) -> list[DeployedAgent]: | ||
if settings.BET_FROM_ADDRESS: | ||
return [ | ||
DeployedOmenAgent( | ||
name="OmenAgent", | ||
start_time=start_time, | ||
wallet_address=Web3.to_checksum_address(settings.BET_FROM_ADDRESS), | ||
) | ||
] | ||
else: | ||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters