Skip to content

Commit

Permalink
Update parameters on README.md (#21)
Browse files Browse the repository at this point in the history
chore: Update README.md

---------

Co-authored-by: Adamantios Zaras <adamantioszaras@gmail.com>
  • Loading branch information
jmoreira-valory and Adamantios authored Jul 21, 2023
1 parent 5aa472f commit 9848601
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ Trader is an autonomous service that performs bets on existing prediction market

- System requirements:

- Python `== 3.10`
- [Tendermint](https://docs.tendermint.com/v0.34/introduction/install.html) `==0.34.19`
- [Poetry](https://python-poetry.org/docs/) `>=1.4.0`
- [Docker Engine](https://docs.docker.com/engine/install/)
- [Docker Compose](https://docs.docker.com/compose/install/)
- Python `== 3.10`
- [Tendermint](https://docs.tendermint.com/v0.34/introduction/install.html) `==0.34.19`
- [Poetry](https://python-poetry.org/docs/) `>=1.4.0`
- [Docker Engine](https://docs.docker.com/engine/install/)
- [Docker Compose](https://docs.docker.com/compose/install/)

- Clone the repository:

Expand All @@ -40,7 +40,7 @@ Trader is an autonomous service that performs bets on existing prediction market

## Testing the service against Gnosis Mainnet

* Prepare some environment variables:
- Prepare some environment variables:

```bash
export RPC_0=INSERT_YOUR_RPC
Expand All @@ -52,24 +52,30 @@ Trader is an autonomous service that performs bets on existing prediction market
export SAFE_CONTRACT_ADDRESS="YOUR_SAFE_ADDRESS"
export OMEN_CREATORS='["CREATOR_0", "CREATOR_1", ...]'

# Optional
# Optional. The following example values bet a variable amount depending on the
# prediction confidence. Here, amounts vary between 0.03 xDAI (60% confidence)
# and 0.1 xDAI (100% confidence). Please, adjust these values accordingly.
export BET_AMOUNT_PER_THRESHOLD_000=0
export BET_AMOUNT_PER_THRESHOLD_000=0
export BET_AMOUNT_PER_THRESHOLD_010=0
export BET_AMOUNT_PER_THRESHOLD_020=0
export BET_AMOUNT_PER_THRESHOLD_030=0
export BET_AMOUNT_PER_THRESHOLD_040=0
export BET_AMOUNT_PER_THRESHOLD_050=0
export BET_AMOUNT_PER_THRESHOLD_060=600000000000000000
export BET_AMOUNT_PER_THRESHOLD_070=900000000000000000
export BET_AMOUNT_PER_THRESHOLD_080=1000000000000000000
export BET_AMOUNT_PER_THRESHOLD_090=10000000000000000000
export BET_AMOUNT_PER_THRESHOLD_100=100000000000000000000
export BET_THRESHOLD=100000000000000000
export BET_AMOUNT_PER_THRESHOLD_060=30000000000000000
export BET_AMOUNT_PER_THRESHOLD_070=40000000000000000
export BET_AMOUNT_PER_THRESHOLD_080=60000000000000000
export BET_AMOUNT_PER_THRESHOLD_090=80000000000000000
export BET_AMOUNT_PER_THRESHOLD_100=100000000000000000

# Threshold for placing a bet 0.005 xDAI
export BET_THRESHOLD=5000000000000000

export PROMPT_TEMPLATE='With the given question "@{question}" and the `yes` option represented by `@{yes}` and the `no` option represented by `@{no}`, what are the respective probabilities of `p_yes` and `p_no` occurring?'
```

Substitute the above placeholders with their respective actual values:
- `RPC_i`: RPC endpoint per agent.
Replace the above placeholders with their respective actual values:
- `RPC_i`: RPC endpoint per agent (you can get an RPC endpoint, e.g. [here](https://getblock.io/)).
- `CHAIN_ID`: identifier of the chain on which the service is running.
- `ALL_PARTICIPANTS`: list of all the agent addresses participating in the service.
This demo is for running the service with a single agent.
Expand All @@ -79,21 +85,22 @@ Trader is an autonomous service that performs bets on existing prediction market
- `OMEN_CREATORS`: addresses of the market creator(s) that the service will track
for placing bets on Omen.
- `BET_AMOUNT_PER_THRESHOLD_X`: amount (wei) to bet when the prediction returned by the AI Mech surpasses a threshold of `X`% confidence.
- `BET_THRESHOLD`: minimum amount (wei) for placing a bet, after calculating the profit.
- `BET_THRESHOLD`: threshold (wei) for placing a bet. That is, a bet will only be placed if `expected_return - bet_fees >= BET_THRESHOLD`. [See below](#some-notes-on-the-service).
- `PROMPT_TEMPLATE`: prompt to be used with the prediction AI Mech. Please keep it as a single line including the placeholders `@{question}`, `@{yes}` and `@{no}`.
* Fetch the service
- Fetch the service
```bash
autonomy fetch --local --service valory/trader && cd trader
```
* Build the image:
- Build the image:
```bash
autonomy build-image
```
* Prepare the agent keys for running the service with a single agent:
- Prepare the agent keys for running the service with a single agent:
```bash
cat > keys.json << EOF
Expand All @@ -108,9 +115,18 @@ Trader is an autonomous service that performs bets on existing prediction market
Please replace with your agent's address and private key in the command above.

* Build the deployment with a single agent and run:
- Build the deployment with a single agent and run:

```bash
autonomy deploy build --n 1 -ltm
autonomy deploy run --build-dir abci_build/
```

## Some notes on the service

Please, take into consideration the following:

- If the service does not have enough funds for placing a bet, you will see an `Event.INSUFICIENT_FUNDS` in the service logs.
- If the service determines that a bet is not profitable (i.e., `expected_return - bet_fees < BET_THRESHOLD`), you will see an `Event.UNPROFITABLE` in the service logs, and the service will transition into the blacklisting round. This round blacklists a bet for a predetermined amount of time. This can be adjusted by using the `BLACKLISTING_DURATION` environment variable.
- For simplicity, the current implementation considers `expected_return = bet_amount`, although this calculation might be refined.
- When assigning `BET_THRESHOLD` take into consideration that fees (at the time of writing this guide) are in the range of 0.02 xDAI. See for example [here](https://api.thegraph.com/subgraphs/name/protofire/omen-xdai/graphql?query=%7B%0A++fixedProductMarketMakers%28%0A++++where%3A+%7B%0A++++++creator_in%3A+%5B%220x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec%22%5D%2C%0A++++++outcomeSlotCount%3A+2%2C%0A++++++isPendingArbitration%3A+false%0A++++%7D%2C%0A++++orderBy%3A+creationTimestamp%0A++++orderDirection%3A+desc%0A++%29%7B%0A++++fee%0A++%7D%0A%7D). We urge you to keep an eye on these fees, as they might vary.

0 comments on commit 9848601

Please sign in to comment.