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

Add configuration required for the strategy #86

Merged
merged 37 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a84f276
feat: add contract for agent registry
Adamantios Sep 20, 2023
86969cf
feat: add contract method to get the mech's id
Adamantios Sep 20, 2023
da8f225
feat: add configs required for the tool selection strategy
Adamantios Sep 20, 2023
89d0594
feat: remove mech tool which will not be necessary anymore
Adamantios Sep 20, 2023
96a4abb
feat: implement an encoder for dataclasses
Adamantios Sep 20, 2023
67b0f2c
feat: implement an `argmax` function
Adamantios Sep 20, 2023
26cea46
feat: implement an Epsilon Greedy Policy
Adamantios Sep 20, 2023
1e6037b
feat: add properties to the synced data of decision maker
Adamantios Sep 20, 2023
54d165b
fix: use the synchronized mech tool
Adamantios Sep 20, 2023
c787272
feat: add policy attribute and property
Adamantios Sep 20, 2023
702bf6d
refactor: move prefix to base
Adamantios Sep 20, 2023
22c67e1
docs: correct docstring
Adamantios Sep 20, 2023
edf70a2
feat: get the transaction hashes of the trades
Adamantios Sep 20, 2023
e7d6373
feat: update the hashes to tool ids mapping
Adamantios Sep 20, 2023
f8540d2
fix: return negative amounts for non-winning positions
Adamantios Sep 20, 2023
1132cac
feat: create a payload for redeeming
Adamantios Sep 20, 2023
af5a794
feat: update the redeeming round to account for the policy
Adamantios Sep 20, 2023
c88ba6d
feat: initialize the policy using the synced data on setup
Adamantios Sep 20, 2023
b7168e1
feat: update the policy and report statistics
Adamantios Sep 20, 2023
c50326b
feat: use the new redeem payload and include updated policy
Adamantios Sep 20, 2023
95f39a6
feat: implement a behaviour for tool selection
Adamantios Sep 20, 2023
9908d03
feat: implement payload for tool selection
Adamantios Sep 20, 2023
4fda0e2
feat: implement round for tool selection
Adamantios Sep 20, 2023
dcb3c0d
feat: add tool selection behaviour to the set of behaviours
Adamantios Sep 20, 2023
3eac849
feat: wire the tool selection round to the FSM
Adamantios Sep 20, 2023
9bd8226
chore: we do not care about the safety of randomness here
Adamantios Sep 20, 2023
127eab8
fix: circular import
Adamantios Sep 20, 2023
f9907a2
fix: add missing contract dependency
Adamantios Sep 20, 2023
d9535df
fix: add missing `set` tag
Adamantios Sep 20, 2023
86879d1
fix: use lists as sets are not supported by the framework
Adamantios Sep 20, 2023
381b8dc
chore: run generators
Adamantios Sep 20, 2023
16cebd3
Merge pull request #92 from valory-xyz/fix/misc
Adamantios Sep 20, 2023
37b8153
Merge pull request #91 from valory-xyz/fix/circular-import
Adamantios Sep 20, 2023
a52f4c8
Merge pull request #90 from valory-xyz/feat/tool-selection
Adamantios Sep 20, 2023
f9a3d50
Merge pull request #89 from valory-xyz/feat/redeeming
Adamantios Sep 20, 2023
7d51809
Merge pull request #88 from valory-xyz/feat/data
Adamantios Sep 20, 2023
c35554a
Merge pull request #87 from valory-xyz/feat/policy
Adamantios Sep 20, 2023
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
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ export ALL_PARTICIPANTS='["YOUR_AGENT_ADDRESS"]'
export SAFE_CONTRACT_ADDRESS="YOUR_SAFE_ADDRESS"
export OMEN_CREATORS='["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]'

export MECH_TOOL="prediction-online"

export BET_AMOUNT_PER_THRESHOLD_000=0
export BET_AMOUNT_PER_THRESHOLD_010=0
export BET_AMOUNT_PER_THRESHOLD_020=0
Expand All @@ -117,12 +115,6 @@ These are the description of the variables used by the Trader service:
- `SAFE_CONTRACT_ADDRESS`: address of the agents multisig wallet created [in the previous section](#prepare-the-keys-and-the-safe).
- `OMEN_CREATORS`: addresses of the market creator(s) that the service will track
for placing bets on Omen. The address `0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec` corresponds to the Market creator agent for the Hackathon.
- `MECH_TOOL`: the tool that the service will use to get the prediction when performing requests to the AI Mech.
You may find all the available Mech scripts [here](https://github.com/valory-xyz/mech/tree/v0.5.0/tools)
for Mech's version `v0.5.0`.
Each script contains one or more tools.
For example, you may find all the `prediction_request` tools
[here](https://github.com/valory-xyz/mech/blob/v0.5.0/tools/prediction_request.py#L37-L40).
- `BET_AMOUNT_PER_THRESHOLD_X`: amount (wei) to bet when the prediction returned by the AI Mech surpasses a threshold of `X`% confidence for a given prediction market. In the values provided above the amounts vary between 0.03 xDAI (60% confidence) and 0.1 xDAI (100% confidence).
- `BET_THRESHOLD`: threshold (wei) for placing a bet. A bet will only be placed if `potential_net_profit - BET_THRESHOLD >= 0`. [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}`.
Expand Down
17 changes: 9 additions & 8 deletions packages/packages.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"dev": {
"skill/valory/market_manager_abci/0.1.0": "bafybeicjqkzen2gvpnc3syojcf6ibr4kjaorcwktikqp2zzxec6vs64oky",
"skill/valory/decision_maker_abci/0.1.0": "bafybeic77zhxf5a53ngfzacklmm3nag4t4jeufdhoeg3ykrmvknojtwipi",
"skill/valory/trader_abci/0.1.0": "bafybeibi3rt3rdk4bvng3tlmwdxal3mk3bflq4cgq3fxyjwzpmhj3y6pmy",
"skill/valory/market_manager_abci/0.1.0": "bafybeigvw5tqei5xb272jb7retxiryhuhxxzupddmbdixgsmxzco3n2dde",
"skill/valory/decision_maker_abci/0.1.0": "bafybeihm77vt53vu3xt6x7istsvaw75juptlynpriebgeltbil5evvhtue",
"skill/valory/trader_abci/0.1.0": "bafybeiea2r67bzi5gkymu2pu2m3sg3lflke5m2finonak4uprqpbdcp2ru",
"contract/valory/market_maker/0.1.0": "bafybeif6hivvhxqv4a3uqo2v3yszluzrmngsp624utdi466xwo5qbz5bsi",
"agent/valory/trader/0.1.0": "bafybeigoojaxpc7sz7vuswkxvpa5lp37lipuwc4qycztqk4hxdesmxqcda",
"service/valory/trader/0.1.0": "bafybeidyuzdmwrt66w32oppopviesvhinmwd76q73zv3dex2th7nldpbyi",
"agent/valory/trader/0.1.0": "bafybeiba5eqawktwkpziiazxm5u6ftm7o3zytcbafqsjwt7zrr63o2yis4",
"service/valory/trader/0.1.0": "bafybeifqi4yprf6ajureyqn45aa3mo7vezwsx63skc4n56grlormdzoz5i",
"contract/valory/erc20/0.1.0": "bafybeiggo4u56drxusvcdruqrr7mlfzqbieg4hajalh4tkctxhh3c5lpdi",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidtrigrfjikl7tkbtowbp6mrdzxulayxnxcmviwy3gag557vnymlq",
"contract/valory/mech/0.1.0": "bafybeibfikekaruskx6ui7u4qnls57i2namfxi45zhqslziqyxg4npjzxu",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiey57caacd6d3ow25i6a2zuiinkx6kjtckdktannk7kijpd3p2zb4",
"contract/valory/mech/0.1.0": "bafybeidtezc4ubsyqdltiojvqe5eeh77ejte7vqbojspiej5quivgap3ae",
"contract/valory/realitio/0.1.0": "bafybeigb722aznqhc5lsbt3dn4bpyaqe5hnl5onmnestqmzliwtvl3eaom",
"contract/valory/realitio_proxy/0.1.0": "bafybeibvndq6756qck7forgeavhdbn6ykgqs2ufyg7n5g6qdfpveatxuwy",
"contract/valory/conditional_tokens/0.1.0": "bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa"
"contract/valory/conditional_tokens/0.1.0": "bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa",
"contract/valory/agent_registry/0.1.0": "bafybeib6odummk6qqietjekpljkmhqfxk7kv56kv6pyfsnnanews625ncy"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeifuxs7gdg2okbn7uofymenjlmnih2wxwkym44lsgwmklgwuckxm2m",
Expand Down
17 changes: 11 additions & 6 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contracts:
- valory/market_maker:0.1.0:bafybeif6hivvhxqv4a3uqo2v3yszluzrmngsp624utdi466xwo5qbz5bsi
- valory/erc20:0.1.0:bafybeiggo4u56drxusvcdruqrr7mlfzqbieg4hajalh4tkctxhh3c5lpdi
- valory/multisend:0.1.0:bafybeidfktuprydtmi4umolfles5qaf7s3t26puvvs44hvkq6uwwr3ia3a
- valory/mech:0.1.0:bafybeibfikekaruskx6ui7u4qnls57i2namfxi45zhqslziqyxg4npjzxu
- valory/mech:0.1.0:bafybeidtezc4ubsyqdltiojvqe5eeh77ejte7vqbojspiej5quivgap3ae
- valory/conditional_tokens:0.1.0:bafybeicxwjdbmjajgr5rsmadtkxxwmcm42r2htef3tvng73uzib4hmb6qa
- valory/realitio:0.1.0:bafybeigb722aznqhc5lsbt3dn4bpyaqe5hnl5onmnestqmzliwtvl3eaom
- valory/realitio_proxy:0.1.0:bafybeibvndq6756qck7forgeavhdbn6ykgqs2ufyg7n5g6qdfpveatxuwy
Expand All @@ -41,10 +41,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiblayblhp5wuirfomwcpgydg35ve5tfq3xxetlosjn47wva5ucmzy
- valory/termination_abci:0.1.0:bafybeieqfhvk6klnvxak3vo2ibslkrnnk2bfsn5l3gbaelcprd6cjngxki
- valory/transaction_settlement_abci:0.1.0:bafybeicisazpyvnnzlqso3txiucxr5qhsa4ac7ius6b4mhouxr2wkadwfy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidtrigrfjikl7tkbtowbp6mrdzxulayxnxcmviwy3gag557vnymlq
- valory/market_manager_abci:0.1.0:bafybeicjqkzen2gvpnc3syojcf6ibr4kjaorcwktikqp2zzxec6vs64oky
- valory/decision_maker_abci:0.1.0:bafybeic77zhxf5a53ngfzacklmm3nag4t4jeufdhoeg3ykrmvknojtwipi
- valory/trader_abci:0.1.0:bafybeibi3rt3rdk4bvng3tlmwdxal3mk3bflq4cgq3fxyjwzpmhj3y6pmy
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiey57caacd6d3ow25i6a2zuiinkx6kjtckdktannk7kijpd3p2zb4
- valory/market_manager_abci:0.1.0:bafybeigvw5tqei5xb272jb7retxiryhuhxxzupddmbdixgsmxzco3n2dde
- valory/decision_maker_abci:0.1.0:bafybeihm77vt53vu3xt6x7istsvaw75juptlynpriebgeltbil5evvhtue
- valory/trader_abci:0.1.0:bafybeiea2r67bzi5gkymu2pu2m3sg3lflke5m2finonak4uprqpbdcp2ru
default_ledger: ethereum
required_ledgers:
- ethereum
Expand Down Expand Up @@ -147,6 +147,7 @@ models:
multisend_address: ${str:0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761}
drand_public_key: ${str:868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31}
service_registry_address: ${str:null}
agent_registry_address: ${str:null}
share_tm_config_on_startup: ${bool:false}
sleep_time: ${int:10}
tendermint_p2p_url: ${str:localhost:26656}
Expand All @@ -161,7 +162,6 @@ models:
average_block_time: ${int:5}
abt_error_mult: ${int:5}
mech_agent_address: ${str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${str:prediction-online}
bet_amount_per_threshold:
0.0: ${int:0}
0.1: ${int:0}
Expand All @@ -187,6 +187,11 @@ models:
redeeming_batch_size: ${int:5}
slippage: ${float:0.01}
redeem_margin_days: ${int:15}
epsilon: ${float:0.1}
irrelevant_tools: ${list:["openai-text-davinci-002", "openai-text-davinci-003",
"openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5",
"stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1",
"stabilityai-stable-diffusion-768-v2-1"]}
---
public_id: valory/p2p_libp2p_client:0.1.0
type: connection
Expand Down
20 changes: 20 additions & 0 deletions packages/valory/contracts/agent_registry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------

"""This module contains the support resources for the agent registry contract."""
Loading
Loading