-
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.
- Loading branch information
Showing
3 changed files
with
91 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import typer | ||
from prediction_market_agent_tooling.tools.web3_utils import verify_address | ||
from prediction_market_agent_tooling.markets.omen import ( | ||
omen_buy_outcome_tx, | ||
get_market, | ||
omen_sell_outcome_tx, | ||
) | ||
from prediction_market_agent_tooling.gtypes import ( | ||
PrivateKey, | ||
xdai_type, | ||
) | ||
from eth_typing import HexStr | ||
|
||
app = typer.Typer() | ||
|
||
|
||
@app.command() | ||
def buy( | ||
amount: str = typer.Option(), | ||
from_address: str = typer.Option(), | ||
from_private_key: str = typer.Option(), | ||
market_id: str = typer.Option(), | ||
outcome: str = typer.Option(), | ||
auto_deposit: bool = typer.Option(False), | ||
) -> None: | ||
""" | ||
Helper script to place a bet on Omen, usage: | ||
```bash | ||
python scripts/bet_omen.py buy \ | ||
--amount 0.01 \ | ||
--from-address your-address \ | ||
--from-private-key your-private-key \ | ||
--market-id some-market-id \ | ||
--outcome one-of-the-outcomes | ||
``` | ||
Market ID can be found easily in the URL: https://aiomen.eth.limo/#/0x86376012a5185f484ec33429cadfa00a8052d9d4 | ||
""" | ||
market = get_market(market_id) | ||
omen_buy_outcome_tx( | ||
amount=xdai_type(amount), | ||
from_address=verify_address(from_address), | ||
from_private_key=PrivateKey(from_private_key), | ||
market=market, | ||
outcome=outcome, | ||
auto_deposit=auto_deposit, | ||
) | ||
|
||
|
||
@app.command() | ||
def sell( | ||
amount: str = typer.Option(), | ||
from_address: str = typer.Option(), | ||
from_private_key: str = typer.Option(), | ||
market_id: str = typer.Option(), | ||
outcome: str = typer.Option(), | ||
auto_withdraw: bool = typer.Option(False), | ||
) -> None: | ||
""" | ||
Helper script to sell outcome of an existing bet on Omen, usage: | ||
```bash | ||
python scripts/bet_omen.py sell \ | ||
--amount 0.01 \ | ||
--from-address your-address \ | ||
--from-private-key your-private-key \ | ||
--market-id some-market-id \ | ||
--outcome one-of-the-outcomes | ||
``` | ||
Market ID can be found easily in the URL: https://aiomen.eth.limo/#/0x86376012a5185f484ec33429cadfa00a8052d9d4 | ||
""" | ||
market = get_market(market_id) | ||
omen_sell_outcome_tx( | ||
amount=xdai_type(amount), | ||
from_address=verify_address(from_address), | ||
from_private_key=PrivateKey(from_private_key), | ||
market=market, | ||
outcome=outcome, | ||
auto_withdraw=auto_withdraw, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |