From 6de37ee4780888552d84edbc8d439fc947b55f21 Mon Sep 17 00:00:00 2001 From: OjusWiZard Date: Wed, 23 Oct 2024 19:35:53 +0530 Subject: [PATCH 1/4] Docs (Readme): Describe trader specific env vars Signed-off-by: OjusWiZard --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 3a3212b0..8c12e875 100644 --- a/README.md +++ b/README.md @@ -297,6 +297,35 @@ and can be overriden by setting it anywhere in the `run_service.sh` script with IRRELEVANT_TOOLS=["some-misbehaving-tool", "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"] ``` +##### Environment variables + +You may customize the agent's behaviour by setting these trader-specific environment variables. + +| Name | Type | Default Value | Description | +| --- | --- | --- | --- | +| `ON_CHAIN_SERVICE_ID` | `int` | `null` | The ID of the on-chain service. | +| `OMEN_CREATORS` | `list` | `["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]` | The addresses of the market creator(s) that the service will track. | +| `OPENING_MARGIN` | `int` | `300` | Extra seconds after which the questions created will be fetched. | +| `LANGUAGES` | `list` | `["en_US"]` | Filter questions by languages. | +| `SAMPLE_BETS_CLOSING_DAYS` | `int` | `10` | Sample the bets that are closed within this number of days. | +| `TRADING_STRATEGY` | `str` | `kelly_criterion_no_conf` | Trading strategy to use. | +| `USE_FALLBACK_STRATEGY` | `bool` | `true` | Whether to use the fallback strategy. | +| `BET_THRESHOLD` | `int` | `100000000000000000` | Threshold (wei) for placing a bet. A bet will only be placed if `potential_net_profit` - `BET_THRESHOLD` >= 0. | +| `PROMPT_TEMPLATE` | `str` | `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?` | The prompt template to use for prompting the mech. | +| `DUST_THRESHOLD` | `int` | `10000000000000` | Minimum amount (wei) below which a position's redeeming amount will be considered dust. | +| `POLICY_EPSILON` | `float` | `0.1` | Epsilon value for the e-Greedy policy for the tool selection based on tool accuracy. | +| `DISABLE_TRADING` | `bool` | `false` | Whether to disable trading. | +| `STOP_TRADING_IF_STAKING_KPI_MET` | `bool` | `true` | Whether to stop trading if the staking KPI is met. | +| `AGENT_BALANCE_THRESHOLD` | `int` | `10000000000000000` | Balance threshold (wei) below which the agent will stop trading and a refill will be required. | +| `REFILL_CHECK_INTERVAL` | `int` | `10` | Interval in seconds to check the agent balance, when waiting for a refill. | +| `FILE_HASH_TO_STRATEGIES_JSON` | `list` | `[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]` | A list of mapping from ipfs file hash to strategy names. | +| `STRATEGIES_KWARGS` | `list` | `[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]` | A list of keyword arguments for the strategies. | +| `USE_SUBGRAPH_FOR_REDEEMING` | `bool` | `true` | Whether to use the subgraph to check if a position is redeemed. | +| `USE_NEVERMINED` | `bool` | `false` | Whether to use Nevermined. | +| `SUBSCRIPTION_PARAMS` | `list` | `[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],["did", "did:nv:01706149da2f9f3f67cf79ec86c37d63cec87fc148f5633b12bf6695653d5b3c"],["escrow_payment_condition_address", "0x31B2D187d674C9ACBD2b25f6EDce3d2Db2B7f446"],["lock_payment_condition_address", "0x2749DDEd394196835199471027713773736bffF2"],["transfer_nft_condition_address", "0x659fCA7436936e9fe8383831b65B8B442eFc8Ea8"],["token_address", "0x1b5DeaD7309b56ca7663b3301A503e077Be18cba"], ["order_address","0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"], ["nft_amount", "100"], ["payment_token","0x0000000000000000000000000000000000000000"], ["order_address", "0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"],["price", "1000000000000000000"]]` | Parameters for the subscription. | + +The rest of the common environment variables are present in the [service.yaml](https://github.com/valory-xyz/trader/blob/main/packages/valory/services/trader/service.yaml), which are customizable too. + ##### Checking agents' health You may check the health of the agents by querying the `/healthcheck` endpoint. For example: From aee4f80eaf454a0295b622c2c70f75b8520796b8 Mon Sep 17 00:00:00 2001 From: Ojuswi Rastogi <55619686+OjusWiZard@users.noreply.github.com> Date: Fri, 25 Oct 2024 00:08:00 +0530 Subject: [PATCH 2/4] Fix `OPENING_MARGIN` description Co-authored-by: Adamantios Zaras --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c12e875..615e225f 100644 --- a/README.md +++ b/README.md @@ -305,7 +305,7 @@ You may customize the agent's behaviour by setting these trader-specific environ | --- | --- | --- | --- | | `ON_CHAIN_SERVICE_ID` | `int` | `null` | The ID of the on-chain service. | | `OMEN_CREATORS` | `list` | `["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]` | The addresses of the market creator(s) that the service will track. | -| `OPENING_MARGIN` | `int` | `300` | Extra seconds after which the questions created will be fetched. | +| `OPENING_MARGIN` | `int` | `300` | The markets opening before this margin will not be fetched. | | `LANGUAGES` | `list` | `["en_US"]` | Filter questions by languages. | | `SAMPLE_BETS_CLOSING_DAYS` | `int` | `10` | Sample the bets that are closed within this number of days. | | `TRADING_STRATEGY` | `str` | `kelly_criterion_no_conf` | Trading strategy to use. | From 7c20a464b97700b0b9f3405e406727aadb464950 Mon Sep 17 00:00:00 2001 From: Ojuswi Rastogi <55619686+OjusWiZard@users.noreply.github.com> Date: Fri, 25 Oct 2024 00:08:36 +0530 Subject: [PATCH 3/4] Specify Nevermined Co-authored-by: Adamantios Zaras --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 615e225f..bdc09e67 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,7 @@ You may customize the agent's behaviour by setting these trader-specific environ | `STRATEGIES_KWARGS` | `list` | `[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]` | A list of keyword arguments for the strategies. | | `USE_SUBGRAPH_FOR_REDEEMING` | `bool` | `true` | Whether to use the subgraph to check if a position is redeemed. | | `USE_NEVERMINED` | `bool` | `false` | Whether to use Nevermined. | -| `SUBSCRIPTION_PARAMS` | `list` | `[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],["did", "did:nv:01706149da2f9f3f67cf79ec86c37d63cec87fc148f5633b12bf6695653d5b3c"],["escrow_payment_condition_address", "0x31B2D187d674C9ACBD2b25f6EDce3d2Db2B7f446"],["lock_payment_condition_address", "0x2749DDEd394196835199471027713773736bffF2"],["transfer_nft_condition_address", "0x659fCA7436936e9fe8383831b65B8B442eFc8Ea8"],["token_address", "0x1b5DeaD7309b56ca7663b3301A503e077Be18cba"], ["order_address","0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"], ["nft_amount", "100"], ["payment_token","0x0000000000000000000000000000000000000000"], ["order_address", "0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"],["price", "1000000000000000000"]]` | Parameters for the subscription. | +| `SUBSCRIPTION_PARAMS` | `list` | `[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],["did", "did:nv:01706149da2f9f3f67cf79ec86c37d63cec87fc148f5633b12bf6695653d5b3c"],["escrow_payment_condition_address", "0x31B2D187d674C9ACBD2b25f6EDce3d2Db2B7f446"],["lock_payment_condition_address", "0x2749DDEd394196835199471027713773736bffF2"],["transfer_nft_condition_address", "0x659fCA7436936e9fe8383831b65B8B442eFc8Ea8"],["token_address", "0x1b5DeaD7309b56ca7663b3301A503e077Be18cba"], ["order_address","0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"], ["nft_amount", "100"], ["payment_token","0x0000000000000000000000000000000000000000"], ["order_address", "0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"],["price", "1000000000000000000"]]` | Parameters for the Nevermined subscription. | The rest of the common environment variables are present in the [service.yaml](https://github.com/valory-xyz/trader/blob/main/packages/valory/services/trader/service.yaml), which are customizable too. From 30f9d7268254dc172ba20a6ce38492231f6e294f Mon Sep 17 00:00:00 2001 From: Ojuswi Rastogi <55619686+OjusWiZard@users.noreply.github.com> Date: Fri, 25 Oct 2024 00:09:06 +0530 Subject: [PATCH 4/4] Use version`v0.18.2` in the link Co-authored-by: Adamantios Zaras --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bdc09e67..2b63598f 100644 --- a/README.md +++ b/README.md @@ -324,7 +324,7 @@ You may customize the agent's behaviour by setting these trader-specific environ | `USE_NEVERMINED` | `bool` | `false` | Whether to use Nevermined. | | `SUBSCRIPTION_PARAMS` | `list` | `[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],["did", "did:nv:01706149da2f9f3f67cf79ec86c37d63cec87fc148f5633b12bf6695653d5b3c"],["escrow_payment_condition_address", "0x31B2D187d674C9ACBD2b25f6EDce3d2Db2B7f446"],["lock_payment_condition_address", "0x2749DDEd394196835199471027713773736bffF2"],["transfer_nft_condition_address", "0x659fCA7436936e9fe8383831b65B8B442eFc8Ea8"],["token_address", "0x1b5DeaD7309b56ca7663b3301A503e077Be18cba"], ["order_address","0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"], ["nft_amount", "100"], ["payment_token","0x0000000000000000000000000000000000000000"], ["order_address", "0x72201948087aE83f8Eac22cf7A9f2139e4cFA829"],["price", "1000000000000000000"]]` | Parameters for the Nevermined subscription. | -The rest of the common environment variables are present in the [service.yaml](https://github.com/valory-xyz/trader/blob/main/packages/valory/services/trader/service.yaml), which are customizable too. +The rest of the common environment variables are present in the [service.yaml](https://github.com/valory-xyz/trader/blob/v0.18.2/packages/valory/services/trader/service.yaml), which are customizable too. ##### Checking agents' health