From 4b2828c4eb6b236b631594a36d330303b6745c42 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Tue, 22 Oct 2024 10:21:03 +0100 Subject: [PATCH 01/23] feat: persisting local tool info --- .../behaviours/storage_manager.py | 117 ++++++++++++++++-- .../skills/decision_maker_abci/policy.py | 2 + 2 files changed, 112 insertions(+), 7 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index f22cae313..612ef8920 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -22,6 +22,7 @@ import csv import json from abc import ABC +from datetime import datetime, timedelta from io import StringIO from typing import Any, Dict, Generator, List, Optional @@ -39,7 +40,6 @@ EGreedyPolicy, ) - POLICY_STORE = "policy_store.json" AVAILABLE_TOOLS_STORE = "available_tools_store.json" UTILIZED_TOOLS_STORE = "utilized_tools.json" @@ -138,7 +138,7 @@ def set_mech_agent_specs(self) -> None: def _get_tools_from_benchmark_file(self) -> None: """Get the tools from the benchmark dataset.""" dataset_filepath = ( - self.params.store_path / self.benchmarking_mode.dataset_filename + self.params.store_path / self.benchmarking_mode.dataset_filename ) with open(dataset_filepath) as read_dataset: row = read_dataset.readline() @@ -212,7 +212,7 @@ def _get_mech_tools(self) -> WaitableConditionType: return True def _get_tools( - self, + self, ) -> Generator[None, None, None]: """Get the Mech's tools.""" if self.benchmarking_mode.enabled: @@ -220,9 +220,9 @@ def _get_tools( return for step in ( - self._get_mech_id, - self._get_mech_hash, - self._get_mech_tools, + self._get_mech_id, + self._get_mech_hash, + self._get_mech_tools, ): yield from self.wait_for_condition_with_sleep(step) @@ -232,6 +232,7 @@ def _try_recover_policy(self) -> Optional[EGreedyPolicy]: policy_path = self.params.store_path / POLICY_STORE with open(policy_path, "r") as f: policy = f.read() + self.context.logger.info("Policy recovered.") return EGreedyPolicy.deserialize(policy) except Exception as e: self.context.logger.warning(f"Could not recover the policy: {e}.") @@ -267,6 +268,98 @@ def _fetch_accuracy_info(self) -> Generator[None, None, bool]: return True + # def _read_accuracy_info_from_local(self) -> None: + # policy_path = self.params.store_path / POLICY_STORE + # + # with open(policy_path, "r") as f: + # accuracy_information = json.load(f) + # self.context.logger.info(f"Accuracy information: {accuracy_information}") + # self.accuracy_information = accuracy_information.deserialize() + + def _read_local_policy_date(self) -> int: + """Reads the updated timestamp from the policy file.""" + + self.context.logger.info("Reading policy updated timestamp...") + policy_path = self.params.store_path / POLICY_STORE + + try: + with open(policy_path, "r") as f: + policy_data = json.load(f) + updated_timestamp = policy_data.get("updated_timestamp") + + if updated_timestamp is not None: + self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") + return updated_timestamp + else: + self.context.logger.info("No timestamp found. Using minium}") + return 1717586000 + + except (json.JSONDecodeError, FileNotFoundError) as e: + self.context.logger.error(f"Error reading timestamp: {e}") + + def _fetch_remote_tool_date(self) -> Generator[None, None, int]: + """ Fetch the max transaction date from the remote accuracy storage.""" + self.context.logger.info("Checking remote accuracy information date... ") + self.context.logger.info("Trying to read max date in file...") + accuracy_link = self.params.ipfs_address + self.params.tools_accuracy_hash + response = yield from self.get_http_response(method=GET, url=accuracy_link) + if response.status_code != OK_CODE: + self.context.logger.error( + f"Could not retrieve data from the url {accuracy_link}. " + f"Received status code {response.status_code}." + ) + return False + + self.context.logger.info("Parsing accuracy information of the tools...") + try: + tool_accuracy_data = StringIO(response.body.decode()) + except (ValueError, TypeError) as e: + self.context.logger.error( + f"Could not parse response from ipfs server, " + f"the following error was encountered {type(e).__name__}: {e}" + ) + sep = self.acc_info_fields.sep + reader: csv.DictReader = csv.DictReader( + tool_accuracy_data, delimiter=sep + ) + + max_transaction_date = None + + # try to read the maximum transaction date in the remote accuracy info + try: + for row in reader: + current_transaction_date = row.get('max') + if max_transaction_date is None or current_transaction_date > max_transaction_date: + max_transaction_date = current_transaction_date + + except TypeError: + self.context.logger("Invalid transaction date found. Continuing with local accuracy information...") + return 1717586000 + + if max_transaction_date: + self.context.logger.info(f"Maximum date found: {max_transaction_date}") + format_str = "%Y-%m-%d %H:%M:%S" + max_datetime = datetime.strptime(max_transaction_date, format_str) + unix_timestamp = int(max_datetime.timestamp()) + return unix_timestamp + + else: + self.context.logger.info("No maximum date found.") + return 1717586000 + + def _check_local_policy_store_overwrite(self) -> Generator[None, None, bool]: + """Compare the local and remote policy store dates and decide which to use.""" + + local_policy_store_date = self._read_local_policy_date() + remote_policy_store_date = yield from self._fetch_remote_tool_date() + three_days_in_seconds = 3 * 24 * 3600 + + self.context.logger.info("Comparing tool accuracy dates...") + if remote_policy_store_date < (local_policy_store_date - three_days_in_seconds): + return True + + return False + def _update_accuracy_store(self, local_tools: List[str]) -> None: """Update the accuracy store file with the latest information available""" self.context.logger.info("Updating accuracy information of the policy...") @@ -291,6 +384,7 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: for tool in local_tools: accuracy_store.setdefault(tool, AccuracyInfo()) + self.policy.updated_timestamp = int(datetime.now().timestamp()) self.policy.update_weighted_accuracy() def _set_policy(self) -> Generator: @@ -308,12 +402,20 @@ def _set_policy(self) -> Generator: self._policy = self.synchronized_data.policy local_tools = self.synchronized_data.available_mech_tools - if self.is_first_period: + overwrite_local_store = yield from self._check_local_policy_store_overwrite() + if self.is_first_period: #and overwrite_local_store: yield from self.wait_for_condition_with_sleep( self._fetch_accuracy_info, sleep_time_override=self.params.sleep_time ) + self._update_accuracy_store(local_tools) + # elif self.is_first_period: + # self.context.logger.info(f"Policy is: {self.policy}") + # self.accuracy_information = self._policy + + + def _try_recover_utilized_tools(self) -> Dict[str, str]: """Try to recover the utilized tools from the tools store.""" tools_path = self.params.store_path / UTILIZED_TOOLS_STORE @@ -351,6 +453,7 @@ def _setup_policy_and_tools(self) -> Generator[None, None, bool]: def _store_policy(self) -> None: """Store the policy""" policy_path = self.params.store_path / POLICY_STORE + with open(policy_path, "w") as f: f.write(self.policy.serialize()) diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index 548e19ee8..e80cc3aec 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -87,9 +87,11 @@ class EGreedyPolicy: """An e-Greedy policy for the tool selection based on tool accuracy.""" eps: float + updated_timestamp: int = 1717586000 accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) + def __post_init__(self) -> None: """Perform post-initialization checks.""" if not (0 <= self.eps <= 1): From e98709ec7657699363f13085f5785ff0811bfbac Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 10:44:26 +0100 Subject: [PATCH 02/23] changes to storage manager --- .../behaviours/storage_manager.py | 37 +++++++++++-------- .../skills/decision_maker_abci/policy.py | 3 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 612ef8920..aec791787 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -268,13 +268,13 @@ def _fetch_accuracy_info(self) -> Generator[None, None, bool]: return True - # def _read_accuracy_info_from_local(self) -> None: - # policy_path = self.params.store_path / POLICY_STORE - # - # with open(policy_path, "r") as f: - # accuracy_information = json.load(f) - # self.context.logger.info(f"Accuracy information: {accuracy_information}") - # self.accuracy_information = accuracy_information.deserialize() + def _read_accuracy_info_from_local(self) -> None: + policy_path = self.params.store_path / POLICY_STORE + + with open(policy_path, "r") as f: + accuracy_information = json.load(f) + self.context.logger.info(f"Accuracy information: {accuracy_information}") + self.accuracy_information = accuracy_information.deserialize() def _read_local_policy_date(self) -> int: """Reads the updated timestamp from the policy file.""" @@ -291,7 +291,7 @@ def _read_local_policy_date(self) -> int: self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") return updated_timestamp else: - self.context.logger.info("No timestamp found. Using minium}") + self.context.logger.info("No timestamp found. Using minium: 1717586000") return 1717586000 except (json.JSONDecodeError, FileNotFoundError) as e: @@ -341,6 +341,7 @@ def _fetch_remote_tool_date(self) -> Generator[None, None, int]: format_str = "%Y-%m-%d %H:%M:%S" max_datetime = datetime.strptime(max_transaction_date, format_str) unix_timestamp = int(max_datetime.timestamp()) + print(f"returning timestamp: {unix_timestamp}") return unix_timestamp else: @@ -352,12 +353,17 @@ def _check_local_policy_store_overwrite(self) -> Generator[None, None, bool]: local_policy_store_date = self._read_local_policy_date() remote_policy_store_date = yield from self._fetch_remote_tool_date() + print(f"Local policy store date: {local_policy_store_date}") + print(f"Remote policy store date: {remote_policy_store_date}") + three_days_in_seconds = 3 * 24 * 3600 self.context.logger.info("Comparing tool accuracy dates...") - if remote_policy_store_date < (local_policy_store_date - three_days_in_seconds): + if remote_policy_store_date > (local_policy_store_date - three_days_in_seconds): + self.context.logger.info("Local policy store overwrite: True") return True + self.context.logger.info("Local policy store overwrite: False") return False def _update_accuracy_store(self, local_tools: List[str]) -> None: @@ -367,6 +373,7 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: reader: csv.DictReader = csv.DictReader( self.accuracy_information, delimiter=sep ) + print(f"POLICY: {self.policy}") accuracy_store = self.policy.accuracy_store # update the accuracy store using the latest accuracy information (only entered during the first period) @@ -392,6 +399,7 @@ def _set_policy(self) -> Generator: if self.is_first_period or not self.synchronized_data.is_policy_set: self.context.logger.debug("Setting initial policy") self._policy = self._get_init_policy() + print(f"THIS IS THE POLICY: {self.policy}") local_tools = self._try_recover_mech_tools() if local_tools is None: local_tools = self.mech_tools @@ -403,17 +411,14 @@ def _set_policy(self) -> Generator: local_tools = self.synchronized_data.available_mech_tools overwrite_local_store = yield from self._check_local_policy_store_overwrite() - if self.is_first_period: #and overwrite_local_store: + if self.is_first_period and overwrite_local_store: yield from self.wait_for_condition_with_sleep( self._fetch_accuracy_info, sleep_time_override=self.params.sleep_time ) + self._update_accuracy_store(local_tools) - self._update_accuracy_store(local_tools) - - # elif self.is_first_period: - # self.context.logger.info(f"Policy is: {self.policy}") - # self.accuracy_information = self._policy - + elif self.is_first_period: + self._read_accuracy_info_from_local() def _try_recover_utilized_tools(self) -> Dict[str, str]: diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index e80cc3aec..b9b08c7c2 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -87,10 +87,9 @@ class EGreedyPolicy: """An e-Greedy policy for the tool selection based on tool accuracy.""" eps: float - updated_timestamp: int = 1717586000 accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) - + updated_timestamp: int = 1717586000 def __post_init__(self) -> None: """Perform post-initialization checks.""" From 07c1c34d0a3d0d5919a29fcb1a2fd8f40586a80a Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 14:31:49 +0100 Subject: [PATCH 03/23] add updated_ts to EGreedyPolicy --- packages/valory/skills/decision_maker_abci/policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index b9b08c7c2..00893204e 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -89,7 +89,7 @@ class EGreedyPolicy: eps: float accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) - updated_timestamp: int = 1717586000 + updated_ts: int = 1717586000 def __post_init__(self) -> None: """Perform post-initialization checks.""" From 4be7e8bacf4dfd06d03ab5924a82ef0aabf245f2 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 14:46:00 +0100 Subject: [PATCH 04/23] storage manager changes --- .../behaviours/storage_manager.py | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index aec791787..bd61611b0 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -226,13 +226,35 @@ def _get_tools( ): yield from self.wait_for_condition_with_sleep(step) + def _read_tool_accuracy_local(self) -> [str|None]: + """Reads the accuracy info from the local policy store file.""" + try: + policy_path = self.params.store_path / POLICY_STORE + with open(policy_path, "r") as f: + policy = f.read() + return policy + + except Exception as e: + self.context.logger.warning(f"Could not recover the policy: {e}.") + return None + + # self.accuracy_information = policy + def _try_recover_policy(self) -> Optional[EGreedyPolicy]: """Try to recover the policy from the policy store.""" try: policy_path = self.params.store_path / POLICY_STORE with open(policy_path, "r") as f: policy = f.read() - self.context.logger.info("Policy recovered.") + + + # verify for updated_ts in policy, deserialize won't work if it's not there + if "updated_ts" not in policy: + # convert json str to dictionary + policy_data = json.loads(policy) + # add updated_ts to policy + policy_data["updated_ts"] = 1717586000 + policy = json.dumps(policy_data) return EGreedyPolicy.deserialize(policy) except Exception as e: self.context.logger.warning(f"Could not recover the policy: {e}.") @@ -268,13 +290,7 @@ def _fetch_accuracy_info(self) -> Generator[None, None, bool]: return True - def _read_accuracy_info_from_local(self) -> None: - policy_path = self.params.store_path / POLICY_STORE - with open(policy_path, "r") as f: - accuracy_information = json.load(f) - self.context.logger.info(f"Accuracy information: {accuracy_information}") - self.accuracy_information = accuracy_information.deserialize() def _read_local_policy_date(self) -> int: """Reads the updated timestamp from the policy file.""" @@ -285,7 +301,7 @@ def _read_local_policy_date(self) -> int: try: with open(policy_path, "r") as f: policy_data = json.load(f) - updated_timestamp = policy_data.get("updated_timestamp") + updated_timestamp = policy_data.get("updated_ts") if updated_timestamp is not None: self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") @@ -353,8 +369,6 @@ def _check_local_policy_store_overwrite(self) -> Generator[None, None, bool]: local_policy_store_date = self._read_local_policy_date() remote_policy_store_date = yield from self._fetch_remote_tool_date() - print(f"Local policy store date: {local_policy_store_date}") - print(f"Remote policy store date: {remote_policy_store_date}") three_days_in_seconds = 3 * 24 * 3600 @@ -373,7 +387,6 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: reader: csv.DictReader = csv.DictReader( self.accuracy_information, delimiter=sep ) - print(f"POLICY: {self.policy}") accuracy_store = self.policy.accuracy_store # update the accuracy store using the latest accuracy information (only entered during the first period) @@ -391,7 +404,7 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: for tool in local_tools: accuracy_store.setdefault(tool, AccuracyInfo()) - self.policy.updated_timestamp = int(datetime.now().timestamp()) + self.policy.updated_ts = int(datetime.now().timestamp()) self.policy.update_weighted_accuracy() def _set_policy(self) -> Generator: @@ -399,7 +412,6 @@ def _set_policy(self) -> Generator: if self.is_first_period or not self.synchronized_data.is_policy_set: self.context.logger.debug("Setting initial policy") self._policy = self._get_init_policy() - print(f"THIS IS THE POLICY: {self.policy}") local_tools = self._try_recover_mech_tools() if local_tools is None: local_tools = self.mech_tools From b1234308becf4269ffd2314d702209137bfa4c1d Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 16:04:06 +0100 Subject: [PATCH 05/23] refactor storage manager changes to remove redundant code --- .../behaviours/storage_manager.py | 105 +++++++----------- .../skills/decision_maker_abci/policy.py | 2 +- 2 files changed, 41 insertions(+), 66 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index bd61611b0..061981ada 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -238,34 +238,24 @@ def _read_tool_accuracy_local(self) -> [str|None]: self.context.logger.warning(f"Could not recover the policy: {e}.") return None - # self.accuracy_information = policy - def _try_recover_policy(self) -> Optional[EGreedyPolicy]: """Try to recover the policy from the policy store.""" - try: - policy_path = self.params.store_path / POLICY_STORE - with open(policy_path, "r") as f: - policy = f.read() - - - # verify for updated_ts in policy, deserialize won't work if it's not there - if "updated_ts" not in policy: - # convert json str to dictionary - policy_data = json.loads(policy) - # add updated_ts to policy - policy_data["updated_ts"] = 1717586000 - policy = json.dumps(policy_data) - return EGreedyPolicy.deserialize(policy) - except Exception as e: - self.context.logger.warning(f"Could not recover the policy: {e}.") - return None + policy = self._read_tool_accuracy_local() + # verify for updated_ts in policy, EGreedyPolicy now stores updated_ts + if "updated_ts" not in policy: + # convert json str to dictionary + policy_data = json.loads(policy) + # add updated_ts to policy + policy_data["updated_ts"] = 0 + policy = json.dumps(policy_data) + return EGreedyPolicy.deserialize(policy) def _get_init_policy(self) -> EGreedyPolicy: """Get the initial policy.""" # try to read the policy from the policy store, and if we cannot recover the policy, we create a new one return self._try_recover_policy() or EGreedyPolicy(self.params.epsilon) - def _fetch_accuracy_info(self) -> Generator[None, None, bool]: + def _fetch_accuracy_info(self) -> Generator[None, None, StringIO|None]: """Fetch the latest accuracy information available.""" # get the CSV file from IPFS self.context.logger.info("Reading accuracy information from IPFS...") @@ -276,64 +266,51 @@ def _fetch_accuracy_info(self) -> Generator[None, None, bool]: f"Could not retrieve data from the url {accuracy_link}. " f"Received status code {response.status_code}." ) - return False + return None - self.context.logger.info("Parsing accuracy information of the tools...") try: - self.accuracy_information = StringIO(response.body.decode()) + tool_accuracy_data = StringIO(response.body.decode()) + self.context.logger.info("Parsing accuracy information of the tools...") + return tool_accuracy_data + except (ValueError, TypeError) as e: self.context.logger.error( f"Could not parse response from ipfs server, " f"the following error was encountered {type(e).__name__}: {e}" ) - return False - - return True + return None + def _set_accuracy_info_from_remote(self) -> None: + self.accuracy_information = yield from self._fetch_accuracy_info() def _read_local_policy_date(self) -> int: """Reads the updated timestamp from the policy file.""" self.context.logger.info("Reading policy updated timestamp...") - policy_path = self.params.store_path / POLICY_STORE - - try: - with open(policy_path, "r") as f: - policy_data = json.load(f) - updated_timestamp = policy_data.get("updated_ts") - - if updated_timestamp is not None: - self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") - return updated_timestamp - else: - self.context.logger.info("No timestamp found. Using minium: 1717586000") - return 1717586000 + policy = self._read_tool_accuracy_local() + policy_json = json.loads(policy) + updated_timestamp = policy_json.get("updated_ts") - except (json.JSONDecodeError, FileNotFoundError) as e: - self.context.logger.error(f"Error reading timestamp: {e}") + if updated_timestamp is not None: + self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") + return updated_timestamp + else: + self.context.logger.info("No timestamp found. Using minium: 0") + return 0 def _fetch_remote_tool_date(self) -> Generator[None, None, int]: """ Fetch the max transaction date from the remote accuracy storage.""" self.context.logger.info("Checking remote accuracy information date... ") self.context.logger.info("Trying to read max date in file...") - accuracy_link = self.params.ipfs_address + self.params.tools_accuracy_hash - response = yield from self.get_http_response(method=GET, url=accuracy_link) - if response.status_code != OK_CODE: - self.context.logger.error( - f"Could not retrieve data from the url {accuracy_link}. " - f"Received status code {response.status_code}." - ) - return False - - self.context.logger.info("Parsing accuracy information of the tools...") - try: - tool_accuracy_data = StringIO(response.body.decode()) - except (ValueError, TypeError) as e: - self.context.logger.error( - f"Could not parse response from ipfs server, " - f"the following error was encountered {type(e).__name__}: {e}" - ) + tool_accuracy_data = yield from self._fetch_accuracy_info() + # try: + # tool_accuracy_data = StringIO(response.body.decode()) + # except (ValueError, TypeError) as e: + # self.context.logger.error( + # f"Could not parse response from ipfs server, " + # f"the following error was encountered {type(e).__name__}: {e}" + # ) sep = self.acc_info_fields.sep reader: csv.DictReader = csv.DictReader( tool_accuracy_data, delimiter=sep @@ -350,7 +327,7 @@ def _fetch_remote_tool_date(self) -> Generator[None, None, int]: except TypeError: self.context.logger("Invalid transaction date found. Continuing with local accuracy information...") - return 1717586000 + return 0 if max_transaction_date: self.context.logger.info(f"Maximum date found: {max_transaction_date}") @@ -362,7 +339,7 @@ def _fetch_remote_tool_date(self) -> Generator[None, None, int]: else: self.context.logger.info("No maximum date found.") - return 1717586000 + return 0 def _check_local_policy_store_overwrite(self) -> Generator[None, None, bool]: """Compare the local and remote policy store dates and decide which to use.""" @@ -424,14 +401,12 @@ def _set_policy(self) -> Generator: overwrite_local_store = yield from self._check_local_policy_store_overwrite() if self.is_first_period and overwrite_local_store: - yield from self.wait_for_condition_with_sleep( - self._fetch_accuracy_info, sleep_time_override=self.params.sleep_time - ) + self._set_accuracy_info_from_remote() self._update_accuracy_store(local_tools) elif self.is_first_period: - self._read_accuracy_info_from_local() - + policy = self._read_tool_accuracy_local() + self.accuracy_information = json.dumps(policy) def _try_recover_utilized_tools(self) -> Dict[str, str]: """Try to recover the utilized tools from the tools store.""" diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index 00893204e..8b87b5753 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -89,7 +89,7 @@ class EGreedyPolicy: eps: float accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) - updated_ts: int = 1717586000 + updated_ts: int = 0 def __post_init__(self) -> None: """Perform post-initialization checks.""" From 553fc63466a4f57482a3496ff5730c5e1d0f3c6c Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 16:55:28 +0100 Subject: [PATCH 06/23] tomte check-code --- .../behaviours/storage_manager.py | 100 ++++++++++-------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 061981ada..98dd4b030 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -22,7 +22,7 @@ import csv import json from abc import ABC -from datetime import datetime, timedelta +from datetime import datetime from io import StringIO from typing import Any, Dict, Generator, List, Optional @@ -40,6 +40,7 @@ EGreedyPolicy, ) + POLICY_STORE = "policy_store.json" AVAILABLE_TOOLS_STORE = "available_tools_store.json" UTILIZED_TOOLS_STORE = "utilized_tools.json" @@ -138,7 +139,7 @@ def set_mech_agent_specs(self) -> None: def _get_tools_from_benchmark_file(self) -> None: """Get the tools from the benchmark dataset.""" dataset_filepath = ( - self.params.store_path / self.benchmarking_mode.dataset_filename + self.params.store_path / self.benchmarking_mode.dataset_filename ) with open(dataset_filepath) as read_dataset: row = read_dataset.readline() @@ -212,7 +213,7 @@ def _get_mech_tools(self) -> WaitableConditionType: return True def _get_tools( - self, + self, ) -> Generator[None, None, None]: """Get the Mech's tools.""" if self.benchmarking_mode.enabled: @@ -220,13 +221,13 @@ def _get_tools( return for step in ( - self._get_mech_id, - self._get_mech_hash, - self._get_mech_tools, + self._get_mech_id, + self._get_mech_hash, + self._get_mech_tools, ): yield from self.wait_for_condition_with_sleep(step) - def _read_tool_accuracy_local(self) -> [str|None]: + def _read_tool_accuracy_local(self) -> str | None: """Reads the accuracy info from the local policy store file.""" try: policy_path = self.params.store_path / POLICY_STORE @@ -241,21 +242,24 @@ def _read_tool_accuracy_local(self) -> [str|None]: def _try_recover_policy(self) -> Optional[EGreedyPolicy]: """Try to recover the policy from the policy store.""" policy = self._read_tool_accuracy_local() - # verify for updated_ts in policy, EGreedyPolicy now stores updated_ts - if "updated_ts" not in policy: - # convert json str to dictionary - policy_data = json.loads(policy) - # add updated_ts to policy - policy_data["updated_ts"] = 0 - policy = json.dumps(policy_data) - return EGreedyPolicy.deserialize(policy) + if policy: + # verify for updated_ts in policy, EGreedyPolicy now stores updated_ts + if policy and "updated_ts" not in policy: + # convert json str to dictionary + policy_data = json.loads(policy) + # add updated_ts to policy + policy_data["updated_ts"] = 0 + policy = json.dumps(policy_data) + return EGreedyPolicy.deserialize(policy) + else: + return None def _get_init_policy(self) -> EGreedyPolicy: """Get the initial policy.""" # try to read the policy from the policy store, and if we cannot recover the policy, we create a new one return self._try_recover_policy() or EGreedyPolicy(self.params.epsilon) - def _fetch_accuracy_info(self) -> Generator[None, None, StringIO|None]: + def _fetch_accuracy_info(self) -> Generator[None, None, StringIO | None]: """Fetch the latest accuracy information available.""" # get the CSV file from IPFS self.context.logger.info("Reading accuracy information from IPFS...") @@ -280,53 +284,59 @@ def _fetch_accuracy_info(self) -> Generator[None, None, StringIO|None]: ) return None - def _set_accuracy_info_from_remote(self) -> None: - - self.accuracy_information = yield from self._fetch_accuracy_info() + def _set_accuracy_info_from_remote(self) -> Generator[None, None, None]: + """Set the tool accuracy info from the remote store.""" + # Fetch accuracy information from remote + tool_accuracy_data = yield from self._fetch_accuracy_info() + if tool_accuracy_data: + self.accuracy_information = tool_accuracy_data def _read_local_policy_date(self) -> int: """Reads the updated timestamp from the policy file.""" self.context.logger.info("Reading policy updated timestamp...") policy = self._read_tool_accuracy_local() - policy_json = json.loads(policy) - updated_timestamp = policy_json.get("updated_ts") - - if updated_timestamp is not None: - self.context.logger.info(f"Local updated timestamp found {updated_timestamp}") - return updated_timestamp - else: - self.context.logger.info("No timestamp found. Using minium: 0") - return 0 + if policy: + policy_json = json.loads(policy) + updated_timestamp = policy_json.get("updated_ts") + + if updated_timestamp is str: + self.context.logger.info( + f"Local updated timestamp found {updated_timestamp}" + ) + return updated_timestamp + else: + self.context.logger.info("No timestamp found. Using minium: 0") + return 0 + return 0 def _fetch_remote_tool_date(self) -> Generator[None, None, int]: - """ Fetch the max transaction date from the remote accuracy storage.""" + """Fetch the max transaction date from the remote accuracy storage.""" self.context.logger.info("Checking remote accuracy information date... ") self.context.logger.info("Trying to read max date in file...") tool_accuracy_data = yield from self._fetch_accuracy_info() - # try: - # tool_accuracy_data = StringIO(response.body.decode()) - # except (ValueError, TypeError) as e: - # self.context.logger.error( - # f"Could not parse response from ipfs server, " - # f"the following error was encountered {type(e).__name__}: {e}" - # ) - sep = self.acc_info_fields.sep - reader: csv.DictReader = csv.DictReader( - tool_accuracy_data, delimiter=sep - ) + + if tool_accuracy_data: + sep = self.acc_info_fields.sep + tool_accuracy_data.seek(0) # Ensure we’re at the beginning + reader = csv.DictReader(tool_accuracy_data.readlines(), delimiter=sep) max_transaction_date = None # try to read the maximum transaction date in the remote accuracy info try: for row in reader: - current_transaction_date = row.get('max') - if max_transaction_date is None or current_transaction_date > max_transaction_date: + current_transaction_date = row.get("max") + if ( + max_transaction_date is None + or current_transaction_date > max_transaction_date + ): max_transaction_date = current_transaction_date except TypeError: - self.context.logger("Invalid transaction date found. Continuing with local accuracy information...") + self.context.logger( + "Invalid transaction date found. Continuing with local accuracy information..." + ) return 0 if max_transaction_date: @@ -401,12 +411,12 @@ def _set_policy(self) -> Generator: overwrite_local_store = yield from self._check_local_policy_store_overwrite() if self.is_first_period and overwrite_local_store: - self._set_accuracy_info_from_remote() + yield from self._set_accuracy_info_from_remote() self._update_accuracy_store(local_tools) elif self.is_first_period: policy = self._read_tool_accuracy_local() - self.accuracy_information = json.dumps(policy) + self.accuracy_information = StringIO(json.dumps(policy)) def _try_recover_utilized_tools(self) -> Dict[str, str]: """Try to recover the utilized tools from the tools store.""" From 24eac663861cdb0cc8ca4782e3936903690eda2a Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 16:56:56 +0100 Subject: [PATCH 07/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 4 ++-- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index f47f8fa70..3aa9590ae 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeigwsffbzx62d3ikz5kyjsewcvknrrnq3bcqgktnbrcpz4g6lyu3eq", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeidmipituxl4xva6h3aeorhqstketwxd7ka7z5fog3jprfr6qx2d3i", - "skill/valory/decision_maker_abci/0.1.0": "bafybeihc6vzoyh3ovhmqiwhm4hen3bbybfskut4ef5i3il36kxqlwt66yq", - "skill/valory/trader_abci/0.1.0": "bafybeib2k6pr7c4wic2uj5ebnqvpbuwikrpzormg7agikipefvdybul2om", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeih6uiqec5buugsxh2zi4geadrqlc6l6q5czltzxoexpthxgylc764", + "skill/valory/decision_maker_abci/0.1.0": "bafybeig2yx6vo5oxzjorecvgegqdeanlc6ga4wwdn2iz3ifwjy2dnwm5kq", + "skill/valory/trader_abci/0.1.0": "bafybeidmg4dyj3znfvh4y5x7i743poeu23bhtgycerbat4mpsmozdzd2li", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihopwa54yiu5bnes3zt43fil46erowpcr6gyyuslq3teuodmnnbw4", "skill/valory/staking_abci/0.1.0": "bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta", - "agent/valory/trader/0.1.0": "bafybeib26xend6jcwxzedk3qce2ckblluohdyjsqsxpvtgrwmtphhok4r4", - "service/valory/trader/0.1.0": "bafybeifht3nlrj477qsloisydwtr6w6e7vgtz2wgmr5jtudfp6rxos7sra", - "service/valory/trader_pearl/0.1.0": "bafybeidts6y6wytfcwlhnvnacf3vhm6lkiocoe22kkmxxx2onzguez3y3q" + "agent/valory/trader/0.1.0": "bafybeid2is5msf6nvyfmtmojbm4i6oqlwsdd2zrp6kdwffuijg5kb2tagq", + "service/valory/trader/0.1.0": "bafybeigux7gtcbn5yxh5fmpd2bnffo2t6daeqryd62n7yzi35t74ninici", + "service/valory/trader_pearl/0.1.0": "bafybeihcwka75kb7qpbntikf6apgnstd52yi56tiagp5wd2jxu735cdaka" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index d82974277..f3eb98dce 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih6uiqec5buugsxh2zi4geadrqlc6l6q5czltzxoexpthxgylc764 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihopwa54yiu5bnes3zt43fil46erowpcr6gyyuslq3teuodmnnbw4 - valory/market_manager_abci:0.1.0:bafybeidmipituxl4xva6h3aeorhqstketwxd7ka7z5fog3jprfr6qx2d3i -- valory/decision_maker_abci:0.1.0:bafybeihc6vzoyh3ovhmqiwhm4hen3bbybfskut4ef5i3il36kxqlwt66yq -- valory/trader_abci:0.1.0:bafybeib2k6pr7c4wic2uj5ebnqvpbuwikrpzormg7agikipefvdybul2om +- valory/decision_maker_abci:0.1.0:bafybeig2yx6vo5oxzjorecvgegqdeanlc6ga4wwdn2iz3ifwjy2dnwm5kq +- valory/trader_abci:0.1.0:bafybeidmg4dyj3znfvh4y5x7i743poeu23bhtgycerbat4mpsmozdzd2li - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 310775e8b..3e4c200cf 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeib26xend6jcwxzedk3qce2ckblluohdyjsqsxpvtgrwmtphhok4r4 +agent: valory/trader:0.1.0:bafybeid2is5msf6nvyfmtmojbm4i6oqlwsdd2zrp6kdwffuijg5kb2tagq number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 200f144c3..8818bb87b 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeib26xend6jcwxzedk3qce2ckblluohdyjsqsxpvtgrwmtphhok4r4 +agent: valory/trader:0.1.0:bafybeid2is5msf6nvyfmtmojbm4i6oqlwsdd2zrp6kdwffuijg5kb2tagq number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index b1084792a..3f230acd2 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeihfpgirg2to2oswf6eda4iaqqotutsbkoju5icm5zkd6z27vjysny - behaviours/storage_manager.py: bafybeibnlg2eirzcxdpnuwbhzne77ear44cqwm4yae5bacgfu4vqqq7d7a + behaviours/storage_manager.py: bafybeibuorsyjmbh3okx2szeajgu7ezyngqr6tiy6zccvy7v6mazg2iajm behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a @@ -34,7 +34,7 @@ fingerprint: io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa models.py: bafybeie6z3vlckwrsindzwdsb2anwcpw6crygydrkjylwrvxkcpwrdc5su payloads.py: bafybeicloiy4ax7dlipwp4czlueflgjgtlev4a6vhn2m7ztoehnemiiko4 - policy.py: bafybeihcltocxg7zsmvjtx44ilal4zir4fz2rupgmhacktzv5neb2lmas4 + policy.py: bafybeif2iwz6lwkqsobiqt4omwyrj54d5bdt6bgmztgu5k67trsy4e4mna redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm rounds.py: bafybeihczrvkid4lqoai7myqqs4f3g5diqsnjotxtqhxhm5c7oowzifbqy states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 9d82fc042..bd3c3630f 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeidmipituxl4xva6h3aeorhqstketwxd7ka7z5fog3jprfr6qx2d3i -- valory/decision_maker_abci:0.1.0:bafybeihc6vzoyh3ovhmqiwhm4hen3bbybfskut4ef5i3il36kxqlwt66yq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeih6uiqec5buugsxh2zi4geadrqlc6l6q5czltzxoexpthxgylc764 +- valory/decision_maker_abci:0.1.0:bafybeig2yx6vo5oxzjorecvgegqdeanlc6ga4wwdn2iz3ifwjy2dnwm5kq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihopwa54yiu5bnes3zt43fil46erowpcr6gyyuslq3teuodmnnbw4 - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 7f54b41c4..7d814a67c 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeihc6vzoyh3ovhmqiwhm4hen3bbybfskut4ef5i3il36kxqlwt66yq +- valory/decision_maker_abci:0.1.0:bafybeig2yx6vo5oxzjorecvgegqdeanlc6ga4wwdn2iz3ifwjy2dnwm5kq - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From 23806989e05f8739a106e7b9906084d0fcde2ea3 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 17:05:09 +0100 Subject: [PATCH 08/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 4 ++-- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 4aad08943..111c3cb9d 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeigwsffbzx62d3ikz5kyjsewcvknrrnq3bcqgktnbrcpz4g6lyu3eq", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeidcnpwi4o7z4wsenxz7tklagdchqunvmdqeyplcybwkoywmb7tvlu", - "skill/valory/trader_abci/0.1.0": "bafybeictsdzjcfvfc2exc5jn4xvkowr24flw65blrgb5uj4jzcdwr7kgpi", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicdzirkebpbyhhkhordyte3gup32yt4nyfpijqihtpmceryrr5o74", + "skill/valory/decision_maker_abci/0.1.0": "bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4", + "skill/valory/trader_abci/0.1.0": "bafybeih676ibzpvenduvamf4a4ua3knjan3cz7xhoaynhijjvqwixp3ode", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury", "skill/valory/staking_abci/0.1.0": "bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta", - "agent/valory/trader/0.1.0": "bafybeihylp5xyzdngcfme3flt2kl6k66s7u4pvb7lsv27mbgotve4y57rq", - "service/valory/trader/0.1.0": "bafybeig2qzh3alfvlwlxuek6235ujplhvtysnfkeq4iu7y6x6lptt7376i", - "service/valory/trader_pearl/0.1.0": "bafybeig4um4w3d4hxz4luwiezdqveuvjm7jgn3axwysrik2xdw2b3rjpta" + "agent/valory/trader/0.1.0": "bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy", + "service/valory/trader/0.1.0": "bafybeieoksdm2iabwfxcmgviktykeepkxsg5wycjdaocikztuonr3gkp3a", + "service/valory/trader_pearl/0.1.0": "bafybeien3efrzcy3z27l7yqgdjm4ruqdutyqg543rnqliq74yvzw4wk7jm" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 757a1ca5d..a8545bdc6 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdzirkebpbyhhkhordyte3gup32yt4nyfpijqihtpmceryrr5o74 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeidcnpwi4o7z4wsenxz7tklagdchqunvmdqeyplcybwkoywmb7tvlu -- valory/trader_abci:0.1.0:bafybeictsdzjcfvfc2exc5jn4xvkowr24flw65blrgb5uj4jzcdwr7kgpi +- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 +- valory/trader_abci:0.1.0:bafybeih676ibzpvenduvamf4a4ua3knjan3cz7xhoaynhijjvqwixp3ode - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 73eea9ea8..2d0d38c60 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeihylp5xyzdngcfme3flt2kl6k66s7u4pvb7lsv27mbgotve4y57rq +agent: valory/trader:0.1.0:bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 6eb5abb86..a6e31c099 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeihylp5xyzdngcfme3flt2kl6k66s7u4pvb7lsv27mbgotve4y57rq +agent: valory/trader:0.1.0:bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 4a5ba404a..19215cb9a 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeibnlg2eirzcxdpnuwbhzne77ear44cqwm4yae5bacgfu4vqqq7d7a + behaviours/storage_manager.py: bafybeibuorsyjmbh3okx2szeajgu7ezyngqr6tiy6zccvy7v6mazg2iajm behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a @@ -34,7 +34,7 @@ fingerprint: io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa models.py: bafybeicpwbvlrj4ag3kcbhjtp6ojvy4g5ggh7zjw47iwilmmhye72lt3fy payloads.py: bafybeicloiy4ax7dlipwp4czlueflgjgtlev4a6vhn2m7ztoehnemiiko4 - policy.py: bafybeihcltocxg7zsmvjtx44ilal4zir4fz2rupgmhacktzv5neb2lmas4 + policy.py: bafybeif2iwz6lwkqsobiqt4omwyrj54d5bdt6bgmztgu5k67trsy4e4mna redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm rounds.py: bafybeihczrvkid4lqoai7myqqs4f3g5diqsnjotxtqhxhm5c7oowzifbqy states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 749294b6c..8e4b11669 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeidcnpwi4o7z4wsenxz7tklagdchqunvmdqeyplcybwkoywmb7tvlu -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdzirkebpbyhhkhordyte3gup32yt4nyfpijqihtpmceryrr5o74 +- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 7360f0e0b..cbdf6efe0 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeidcnpwi4o7z4wsenxz7tklagdchqunvmdqeyplcybwkoywmb7tvlu +- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From 729f0f026724bbfc333be4915c89e7ba48eb9fdd Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 25 Oct 2024 17:22:09 +0100 Subject: [PATCH 09/23] make type optional --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../behaviours/storage_manager.py | 4 ++-- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 111c3cb9d..dccb0c9c2 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeigwsffbzx62d3ikz5kyjsewcvknrrnq3bcqgktnbrcpz4g6lyu3eq", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4", - "skill/valory/trader_abci/0.1.0": "bafybeih676ibzpvenduvamf4a4ua3knjan3cz7xhoaynhijjvqwixp3ode", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury", + "skill/valory/decision_maker_abci/0.1.0": "bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54", + "skill/valory/trader_abci/0.1.0": "bafybeigt2zrr22nipr3ermirgbevcco3dqt3m7hzbz7phaodk6w4sylyyi", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki", "skill/valory/staking_abci/0.1.0": "bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta", - "agent/valory/trader/0.1.0": "bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy", - "service/valory/trader/0.1.0": "bafybeieoksdm2iabwfxcmgviktykeepkxsg5wycjdaocikztuonr3gkp3a", - "service/valory/trader_pearl/0.1.0": "bafybeien3efrzcy3z27l7yqgdjm4ruqdutyqg543rnqliq74yvzw4wk7jm" + "agent/valory/trader/0.1.0": "bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m", + "service/valory/trader/0.1.0": "bafybeideroxzi4eyhd4psceejhvzwwphldneywmkm32wkch4d2bmpjgsze", + "service/valory/trader_pearl/0.1.0": "bafybeigo4hpvahhjjq6yzcry45sy37bzqlthmpfwfcabvpwzosfcg63tmi" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index a8545bdc6..5d3183f98 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 -- valory/trader_abci:0.1.0:bafybeih676ibzpvenduvamf4a4ua3knjan3cz7xhoaynhijjvqwixp3ode +- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 +- valory/trader_abci:0.1.0:bafybeigt2zrr22nipr3ermirgbevcco3dqt3m7hzbz7phaodk6w4sylyyi - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 2d0d38c60..c9919260c 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy +agent: valory/trader:0.1.0:bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index a6e31c099..e3e8e1706 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifv4hhwxincgre3xwushdsbi36u7ucnst3y2crnr3sovkzaeq5iiy +agent: valory/trader:0.1.0:bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 98dd4b030..bc42fa85e 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -227,7 +227,7 @@ def _get_tools( ): yield from self.wait_for_condition_with_sleep(step) - def _read_tool_accuracy_local(self) -> str | None: + def _read_tool_accuracy_local(self) -> Optional[str]: """Reads the accuracy info from the local policy store file.""" try: policy_path = self.params.store_path / POLICY_STORE @@ -259,7 +259,7 @@ def _get_init_policy(self) -> EGreedyPolicy: # try to read the policy from the policy store, and if we cannot recover the policy, we create a new one return self._try_recover_policy() or EGreedyPolicy(self.params.epsilon) - def _fetch_accuracy_info(self) -> Generator[None, None, StringIO | None]: + def _fetch_accuracy_info(self) -> Generator[None, None, Optional[StringIO]]: """Fetch the latest accuracy information available.""" # get the CSV file from IPFS self.context.logger.info("Reading accuracy information from IPFS...") diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 19215cb9a..de11ecc4b 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeibuorsyjmbh3okx2szeajgu7ezyngqr6tiy6zccvy7v6mazg2iajm + behaviours/storage_manager.py: bafybeiacduyutgmme5lihetfifmhmuplguc5ua2yp3hvshtcz3pv2ers6u behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 8e4b11669..d7bf7f07e 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigyosbje4vwg4aclpfymfc23rqbubruqzpjtw5nv5mikp5kmwdury +- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index cbdf6efe0..ee6211246 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeieppuyvmkmtwz3ikrv27lxwuc2ko5q2xlefh2jx2yblsdrqccx5n4 +- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From fb6daa1c74c7bc55a6bb0a9e4caa668164d78281 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 1 Nov 2024 16:28:54 +0000 Subject: [PATCH 10/23] add suggested changes --- packages/packages.json | 12 ++-- packages/valory/agents/trader/aea-config.yaml | 7 ++- packages/valory/services/trader/service.yaml | 2 +- .../valory/services/trader_pearl/service.yaml | 2 +- .../behaviours/storage_manager.py | 56 ++++++++++++------- .../skills/decision_maker_abci/models.py | 3 + .../skills/decision_maker_abci/policy.py | 3 +- .../skills/decision_maker_abci/skill.yaml | 6 +- packages/valory/skills/trader_abci/skill.yaml | 4 +- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 10 files changed, 58 insertions(+), 39 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index dccb0c9c2..4095cc75a 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeigwsffbzx62d3ikz5kyjsewcvknrrnq3bcqgktnbrcpz4g6lyu3eq", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54", - "skill/valory/trader_abci/0.1.0": "bafybeigt2zrr22nipr3ermirgbevcco3dqt3m7hzbz7phaodk6w4sylyyi", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi", + "skill/valory/trader_abci/0.1.0": "bafybeibaypb67vs44u3zjj5egnztsckqkpffoaido54yjoqk7hrugfcuwu", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau", "skill/valory/staking_abci/0.1.0": "bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta", - "agent/valory/trader/0.1.0": "bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m", - "service/valory/trader/0.1.0": "bafybeideroxzi4eyhd4psceejhvzwwphldneywmkm32wkch4d2bmpjgsze", - "service/valory/trader_pearl/0.1.0": "bafybeigo4hpvahhjjq6yzcry45sy37bzqlthmpfwfcabvpwzosfcg63tmi" + "agent/valory/trader/0.1.0": "bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy", + "service/valory/trader/0.1.0": "bafybeic63mv4jupowirlwlavyilo6s672cebshfmculoxrgu64ddyuvfny", + "service/valory/trader_pearl/0.1.0": "bafybeifwesumqtcqfj77zcxl3me7pow5h7yxedeoc4ukbi6dq5je4z7qjm" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 5d3183f98..1188197b4 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 -- valory/trader_abci:0.1.0:bafybeigt2zrr22nipr3ermirgbevcco3dqt3m7hzbz7phaodk6w4sylyyi +- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi +- valory/trader_abci:0.1.0:bafybeibaypb67vs44u3zjj5egnztsckqkpffoaido54yjoqk7hrugfcuwu - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm @@ -237,6 +237,7 @@ models: rebet_chance: ${float:0.6} mech_interaction_sleep_time: ${int:10} use_mech_marketplace: ${bool:false} + policy_store_update_offset: ${int:259200} mech_marketplace_config: mech_marketplace_address: ${str:0x0000000000000000000000000000000000000000} priority_mech_address: ${str:0x0000000000000000000000000000000000000000} diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index c9919260c..a591bbb04 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m +agent: valory/trader:0.1.0:bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index e3e8e1706..80f8db778 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidc57hegq3uoq5bttacf7zkty2b5cjm5fwwkwhyxjx3bmv5iurq6m +agent: valory/trader:0.1.0:bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index bc42fa85e..32bd4b01a 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -243,12 +243,12 @@ def _try_recover_policy(self) -> Optional[EGreedyPolicy]: """Try to recover the policy from the policy store.""" policy = self._read_tool_accuracy_local() if policy: - # verify for updated_ts in policy, EGreedyPolicy now stores updated_ts + # verify for updated_ts in policy, EGreedyPolicy accuracy_store now stores updated_ts if policy and "updated_ts" not in policy: # convert json str to dictionary policy_data = json.loads(policy) # add updated_ts to policy - policy_data["updated_ts"] = 0 + policy_data["accuracy_store"]["updated_ts"] = 0 policy = json.dumps(policy_data) return EGreedyPolicy.deserialize(policy) else: @@ -284,23 +284,25 @@ def _fetch_accuracy_info(self) -> Generator[None, None, Optional[StringIO]]: ) return None - def _set_accuracy_info_from_remote(self) -> Generator[None, None, None]: + def _set_accuracy_info_from_remote( + self, + remote_accuracy_info: Generator[None, None, Optional[StringIO]] + ) -> None: """Set the tool accuracy info from the remote store.""" - # Fetch accuracy information from remote - tool_accuracy_data = yield from self._fetch_accuracy_info() - if tool_accuracy_data: + tool_accuracy_data = remote_accuracy_info + + if tool_accuracy_data is not None: self.accuracy_information = tool_accuracy_data def _read_local_policy_date(self) -> int: """Reads the updated timestamp from the policy file.""" - self.context.logger.info("Reading policy updated timestamp...") policy = self._read_tool_accuracy_local() if policy: policy_json = json.loads(policy) updated_timestamp = policy_json.get("updated_ts") - if updated_timestamp is str: + if updated_timestamp: self.context.logger.info( f"Local updated timestamp found {updated_timestamp}" ) @@ -310,11 +312,13 @@ def _read_local_policy_date(self) -> int: return 0 return 0 - def _fetch_remote_tool_date(self) -> Generator[None, None, int]: + def _fetch_remote_tool_date( + self, remote_accuracy_info + ) -> Generator[None, None, int]: """Fetch the max transaction date from the remote accuracy storage.""" self.context.logger.info("Checking remote accuracy information date... ") self.context.logger.info("Trying to read max date in file...") - tool_accuracy_data = yield from self._fetch_accuracy_info() + tool_accuracy_data = remote_accuracy_info if tool_accuracy_data: sep = self.acc_info_fields.sep @@ -334,7 +338,7 @@ def _fetch_remote_tool_date(self) -> Generator[None, None, int]: max_transaction_date = current_transaction_date except TypeError: - self.context.logger( + self.context.logger.warning( "Invalid transaction date found. Continuing with local accuracy information..." ) return 0 @@ -347,20 +351,25 @@ def _fetch_remote_tool_date(self) -> Generator[None, None, int]: print(f"returning timestamp: {unix_timestamp}") return unix_timestamp - else: - self.context.logger.info("No maximum date found.") - return 0 + self.context.logger.info("No maximum date found.") + return 0 - def _check_local_policy_store_overwrite(self) -> Generator[None, None, bool]: + def _check_local_policy_store_overwrite( + self, remote_accuracy_info + ) -> Generator[None, None, bool]: """Compare the local and remote policy store dates and decide which to use.""" local_policy_store_date = self._read_local_policy_date() - remote_policy_store_date = yield from self._fetch_remote_tool_date() + remote_policy_store_date = yield from self._fetch_remote_tool_date( + remote_accuracy_info + ) - three_days_in_seconds = 3 * 24 * 3600 + policy_store_update_offset = self.params.policy_store_update_offset self.context.logger.info("Comparing tool accuracy dates...") - if remote_policy_store_date > (local_policy_store_date - three_days_in_seconds): + if remote_policy_store_date > ( + local_policy_store_date - policy_store_update_offset + ): self.context.logger.info("Local policy store overwrite: True") return True @@ -391,7 +400,9 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: for tool in local_tools: accuracy_store.setdefault(tool, AccuracyInfo()) - self.policy.updated_ts = int(datetime.now().timestamp()) + self.policy.accuracy_store["accuracy_info"].updated_ts = int( + datetime.now().timestamp() + ) self.policy.update_weighted_accuracy() def _set_policy(self) -> Generator: @@ -409,9 +420,12 @@ def _set_policy(self) -> Generator: self._policy = self.synchronized_data.policy local_tools = self.synchronized_data.available_mech_tools - overwrite_local_store = yield from self._check_local_policy_store_overwrite() + remote_accuracy_info = yield from self._fetch_accuracy_info() + overwrite_local_store = yield from self._check_local_policy_store_overwrite( + remote_accuracy_info + ) if self.is_first_period and overwrite_local_store: - yield from self._set_accuracy_info_from_remote() + yield from self._set_accuracy_info_from_remote(remote_accuracy_info) self._update_accuracy_store(local_tools) elif self.is_first_period: diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 0b90f2e9d..230331e66 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -413,6 +413,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.service_endpoint = self._ensure("service_endpoint", kwargs, str) self.safe_voting_range = self._ensure("safe_voting_range", kwargs, int) self.rebet_chance = self._ensure("rebet_chance", kwargs, float) + self.policy_store_update_offset = self._ensure( + "policy_store_update_offset", kwargs, float + ) super().__init__(*args, **kwargs) @property diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index 8b87b5753..d6363ec96 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -59,6 +59,8 @@ class AccuracyInfo: pending: int = 0 # the accuracy of the tool accuracy: float = 0.0 + # the timestamp of updating + updated_ts: int = 0 class EGreedyPolicyDecoder(json.JSONDecoder): @@ -89,7 +91,6 @@ class EGreedyPolicy: eps: float accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) - updated_ts: int = 0 def __post_init__(self) -> None: """Perform post-initialization checks.""" diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index de11ecc4b..ef9961bb1 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,16 +25,16 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeiacduyutgmme5lihetfifmhmuplguc5ua2yp3hvshtcz3pv2ers6u + behaviours/storage_manager.py: bafybeiamzuntvgph7tgkxvoezdzip65vf6xnmu3vm5s6ftzqjzkj3zpqe4 behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a handlers.py: bafybeigod6gbjrxy4mbmulbzsbokeaoycoqys64vqtxnumishfukzf73za io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeicpwbvlrj4ag3kcbhjtp6ojvy4g5ggh7zjw47iwilmmhye72lt3fy + models.py: bafybeihwg74syhibkg76vs45dvd3tm6iiyiicdncjuo6vzembwjz42o6ie payloads.py: bafybeicloiy4ax7dlipwp4czlueflgjgtlev4a6vhn2m7ztoehnemiiko4 - policy.py: bafybeif2iwz6lwkqsobiqt4omwyrj54d5bdt6bgmztgu5k67trsy4e4mna + policy.py: bafybeict5loy6yymz6ta4lpt4v5qiy42sesanb23dfaqhagitcdnl3fmri redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm rounds.py: bafybeihczrvkid4lqoai7myqqs4f3g5diqsnjotxtqhxhm5c7oowzifbqy states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index d7bf7f07e..c884ad706 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdownpfav4s4ckbl6pa7hlxfbdxqbsdapoagrfqi6s2xu7a5g2ki +- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index ee6211246..2bf450415 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeifxsoopgxtxzy6tp2fp4x5zxl6vnxrm3xco422lv6gb5budxqtx54 +- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From d574ce14e928ccbd841f53d6a11703d31fd6ff47 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Thu, 14 Nov 2024 10:42:01 +0000 Subject: [PATCH 11/23] refactor: _check_local_policy_store_overwrite --- .../decision_maker_abci/behaviours/storage_manager.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 32bd4b01a..94b5a8409 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -367,14 +367,10 @@ def _check_local_policy_store_overwrite( policy_store_update_offset = self.params.policy_store_update_offset self.context.logger.info("Comparing tool accuracy dates...") - if remote_policy_store_date > ( - local_policy_store_date - policy_store_update_offset - ): - self.context.logger.info("Local policy store overwrite: True") - return True - self.context.logger.info("Local policy store overwrite: False") - return False + overwrite = True if remote_policy_store_date > (local_policy_store_date - policy_store_update_offset) else False + self.context.logger.info("Local policy store overwrite: {overwrite}") + return overwrite def _update_accuracy_store(self, local_tools: List[str]) -> None: """Update the accuracy store file with the latest information available""" From 427c678e747d39ed79494fdc7a6d00212628f773 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Thu, 14 Nov 2024 10:46:36 +0000 Subject: [PATCH 12/23] refactor: constants --- .../decision_maker_abci/behaviours/storage_manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 94b5a8409..3e6ff1407 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -46,6 +46,8 @@ UTILIZED_TOOLS_STORE = "utilized_tools.json" GET = "GET" OK_CODE = 200 +MAX_STR = "max" +DATETIME_FORMAT_STR = "%Y-%m-%d %H:%M:%S" class StorageManagerBehaviour(DecisionMakerBaseBehaviour, ABC): @@ -330,7 +332,7 @@ def _fetch_remote_tool_date( # try to read the maximum transaction date in the remote accuracy info try: for row in reader: - current_transaction_date = row.get("max") + current_transaction_date = row.get(MAX_STR) if ( max_transaction_date is None or current_transaction_date > max_transaction_date @@ -345,8 +347,7 @@ def _fetch_remote_tool_date( if max_transaction_date: self.context.logger.info(f"Maximum date found: {max_transaction_date}") - format_str = "%Y-%m-%d %H:%M:%S" - max_datetime = datetime.strptime(max_transaction_date, format_str) + max_datetime = datetime.strptime(max_transaction_date, DATETIME_FORMAT_STR) unix_timestamp = int(max_datetime.timestamp()) print(f"returning timestamp: {unix_timestamp}") return unix_timestamp From 857e9992db3ab314d062bcfd1ccf7624d955a9ec Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Thu, 14 Nov 2024 15:35:28 +0000 Subject: [PATCH 13/23] implemented requested changes --- packages/valory/services/trader/service.yaml | 1 + .../behaviours/storage_manager.py | 111 +++++------------- .../skills/decision_maker_abci/models.py | 2 +- .../skills/decision_maker_abci/policy.py | 11 +- .../skills/decision_maker_abci/skill.yaml | 1 + packages/valory/skills/trader_abci/skill.yaml | 1 + 6 files changed, 44 insertions(+), 83 deletions(-) diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index a591bbb04..d83051c43 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -143,6 +143,7 @@ type: skill rpc_sleep_time: ${RPC_SLEEP_TIME:int:10} safe_voting_range: ${SAFE_VOTING_RANGE:int:600} rebet_chance: ${REBET_CHANCE:float:0.6} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} mech_interaction_sleep_time: ${MECH_INTERACTION_SLEEP_TIME:int:10} benchmark_tool: &id004 args: diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 3e6ff1407..b8aa6dd0e 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -37,6 +37,7 @@ from packages.valory.skills.decision_maker_abci.models import AgentToolsSpecs from packages.valory.skills.decision_maker_abci.policy import ( AccuracyInfo, + DataclassEncoder, EGreedyPolicy, ) @@ -229,39 +230,23 @@ def _get_tools( ): yield from self.wait_for_condition_with_sleep(step) - def _read_tool_accuracy_local(self) -> Optional[str]: - """Reads the accuracy info from the local policy store file.""" + def _try_recover_policy(self) -> Optional[EGreedyPolicy]: + """Try to recover the policy from the policy store.""" try: policy_path = self.params.store_path / POLICY_STORE with open(policy_path, "r") as f: policy = f.read() - return policy - + return EGreedyPolicy.deserialize(policy) except Exception as e: self.context.logger.warning(f"Could not recover the policy: {e}.") return None - def _try_recover_policy(self) -> Optional[EGreedyPolicy]: - """Try to recover the policy from the policy store.""" - policy = self._read_tool_accuracy_local() - if policy: - # verify for updated_ts in policy, EGreedyPolicy accuracy_store now stores updated_ts - if policy and "updated_ts" not in policy: - # convert json str to dictionary - policy_data = json.loads(policy) - # add updated_ts to policy - policy_data["accuracy_store"]["updated_ts"] = 0 - policy = json.dumps(policy_data) - return EGreedyPolicy.deserialize(policy) - else: - return None - def _get_init_policy(self) -> EGreedyPolicy: """Get the initial policy.""" # try to read the policy from the policy store, and if we cannot recover the policy, we create a new one return self._try_recover_policy() or EGreedyPolicy(self.params.epsilon) - def _fetch_accuracy_info(self) -> Generator[None, None, Optional[StringIO]]: + def _fetch_accuracy_info(self) -> Generator[None, None, bool]: """Fetch the latest accuracy information available.""" # get the CSV file from IPFS self.context.logger.info("Reading accuracy information from IPFS...") @@ -272,60 +257,30 @@ def _fetch_accuracy_info(self) -> Generator[None, None, Optional[StringIO]]: f"Could not retrieve data from the url {accuracy_link}. " f"Received status code {response.status_code}." ) - return None + return False + self.context.logger.info("Parsing accuracy information of the tools...") try: - tool_accuracy_data = StringIO(response.body.decode()) - self.context.logger.info("Parsing accuracy information of the tools...") - return tool_accuracy_data - + self.accuracy_information = StringIO(response.body.decode()) except (ValueError, TypeError) as e: self.context.logger.error( f"Could not parse response from ipfs server, " f"the following error was encountered {type(e).__name__}: {e}" ) - return None + return False - def _set_accuracy_info_from_remote( - self, - remote_accuracy_info: Generator[None, None, Optional[StringIO]] - ) -> None: - """Set the tool accuracy info from the remote store.""" - tool_accuracy_data = remote_accuracy_info - - if tool_accuracy_data is not None: - self.accuracy_information = tool_accuracy_data - - def _read_local_policy_date(self) -> int: - """Reads the updated timestamp from the policy file.""" - self.context.logger.info("Reading policy updated timestamp...") - policy = self._read_tool_accuracy_local() - if policy: - policy_json = json.loads(policy) - updated_timestamp = policy_json.get("updated_ts") - - if updated_timestamp: - self.context.logger.info( - f"Local updated timestamp found {updated_timestamp}" - ) - return updated_timestamp - else: - self.context.logger.info("No timestamp found. Using minium: 0") - return 0 - return 0 + return True - def _fetch_remote_tool_date( - self, remote_accuracy_info - ) -> Generator[None, None, int]: + def _fetch_remote_tool_date(self) -> int: """Fetch the max transaction date from the remote accuracy storage.""" self.context.logger.info("Checking remote accuracy information date... ") self.context.logger.info("Trying to read max date in file...") - tool_accuracy_data = remote_accuracy_info + accuracy_information = self.accuracy_information - if tool_accuracy_data: + if accuracy_information: sep = self.acc_info_fields.sep - tool_accuracy_data.seek(0) # Ensure we’re at the beginning - reader = csv.DictReader(tool_accuracy_data.readlines(), delimiter=sep) + accuracy_information.seek(0) # Ensure we’re at the beginning + reader = csv.DictReader(accuracy_information.readlines(), delimiter=sep) max_transaction_date = None @@ -355,22 +310,22 @@ def _fetch_remote_tool_date( self.context.logger.info("No maximum date found.") return 0 - def _check_local_policy_store_overwrite( - self, remote_accuracy_info - ) -> Generator[None, None, bool]: + def _check_local_policy_store_overwrite(self) -> bool: """Compare the local and remote policy store dates and decide which to use.""" - local_policy_store_date = self._read_local_policy_date() - remote_policy_store_date = yield from self._fetch_remote_tool_date( - remote_accuracy_info - ) - + local_policy_store_date = self._policy.updated_ts + remote_policy_store_date = self._fetch_remote_tool_date() policy_store_update_offset = self.params.policy_store_update_offset self.context.logger.info("Comparing tool accuracy dates...") - overwrite = True if remote_policy_store_date > (local_policy_store_date - policy_store_update_offset) else False - self.context.logger.info("Local policy store overwrite: {overwrite}") + overwrite = ( + True + if remote_policy_store_date + > (local_policy_store_date - policy_store_update_offset) + else False + ) + self.context.logger.info(f"Local policy store overwrite: {overwrite}.") return overwrite def _update_accuracy_store(self, local_tools: List[str]) -> None: @@ -397,9 +352,6 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None: for tool in local_tools: accuracy_store.setdefault(tool, AccuracyInfo()) - self.policy.accuracy_store["accuracy_info"].updated_ts = int( - datetime.now().timestamp() - ) self.policy.update_weighted_accuracy() def _set_policy(self) -> Generator: @@ -417,17 +369,18 @@ def _set_policy(self) -> Generator: self._policy = self.synchronized_data.policy local_tools = self.synchronized_data.available_mech_tools - remote_accuracy_info = yield from self._fetch_accuracy_info() - overwrite_local_store = yield from self._check_local_policy_store_overwrite( - remote_accuracy_info + yield from self.wait_for_condition_with_sleep( + self._fetch_accuracy_info, sleep_time_override=self.params.sleep_time ) + overwrite_local_store = self._check_local_policy_store_overwrite() + if self.is_first_period and overwrite_local_store: - yield from self._set_accuracy_info_from_remote(remote_accuracy_info) + self.policy.updated_ts = int(datetime.now().timestamp()) self._update_accuracy_store(local_tools) elif self.is_first_period: - policy = self._read_tool_accuracy_local() - self.accuracy_information = StringIO(json.dumps(policy)) + policy_json = json.dumps(self.policy, cls=DataclassEncoder) + self.accuracy_information = StringIO(policy_json) def _try_recover_utilized_tools(self) -> Dict[str, str]: """Try to recover the utilized tools from the tools store.""" diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index 230331e66..7b6b3a7c0 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -414,7 +414,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.safe_voting_range = self._ensure("safe_voting_range", kwargs, int) self.rebet_chance = self._ensure("rebet_chance", kwargs, float) self.policy_store_update_offset = self._ensure( - "policy_store_update_offset", kwargs, float + "policy_store_update_offset", kwargs, int ) super().__init__(*args, **kwargs) diff --git a/packages/valory/skills/decision_maker_abci/policy.py b/packages/valory/skills/decision_maker_abci/policy.py index d6363ec96..0b3db3a6c 100644 --- a/packages/valory/skills/decision_maker_abci/policy.py +++ b/packages/valory/skills/decision_maker_abci/policy.py @@ -59,8 +59,6 @@ class AccuracyInfo: pending: int = 0 # the accuracy of the tool accuracy: float = 0.0 - # the timestamp of updating - updated_ts: int = 0 class EGreedyPolicyDecoder(json.JSONDecoder): @@ -77,7 +75,13 @@ def hook( """Perform the custom decoding.""" for cls_ in (AccuracyInfo, EGreedyPolicy): cls_attributes = cls_.__annotations__.keys() # pylint: disable=no-member - if sorted(cls_attributes) == sorted(data.keys()): + if sorted(cls_attributes) == sorted(data.keys()) or ( + cls_ == EGreedyPolicy + and sorted(cls_attributes - {"updated_ts"}) == sorted(data.keys()) + ): + # If EGreedyPolicy and 'updated_ts' is missing, set it to 0 + if cls_ == EGreedyPolicy and "updated_ts" not in data: + data["updated_ts"] = 0 # if the attributes match the ones of the current class, use it to perform the deserialization return cls_(**data) @@ -91,6 +95,7 @@ class EGreedyPolicy: eps: float accuracy_store: Dict[str, AccuracyInfo] = field(default_factory=dict) weighted_accuracy: Dict[str, float] = field(default_factory=dict) + updated_ts: int = 0 def __post_init__(self) -> None: """Perform post-initialization checks.""" diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index ef9961bb1..6af99c745 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -231,6 +231,7 @@ models: policy_epsilon: 0.1 use_subgraph_for_redeeming: true use_nevermined: true + policy_store_update_offset: 259200 mech_to_subscription_params: - - base_url - https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index c884ad706..9e42428b0 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -178,6 +178,7 @@ models: slippage: 0.01 policy_epsilon: 0.1 store_path: /data/ + policy_store_update_offset: 259200 use_subgraph_for_redeeming: true irrelevant_tools: - openai-text-davinci-002 From 041eb7291b367cf3bda077e1097f18ff4129214d Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Thu, 14 Nov 2024 15:41:22 +0000 Subject: [PATCH 14/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../behaviours/storage_manager.py | 3 +-- .../valory/skills/decision_maker_abci/skill.yaml | 6 +++--- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 4095cc75a..b56be0f29 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeigwsffbzx62d3ikz5kyjsewcvknrrnq3bcqgktnbrcpz4g6lyu3eq", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi", - "skill/valory/trader_abci/0.1.0": "bafybeibaypb67vs44u3zjj5egnztsckqkpffoaido54yjoqk7hrugfcuwu", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiah7epnjdxy7ogijjutirpk4dchb52p6k5paaonast3unvj62qmzq", + "skill/valory/trader_abci/0.1.0": "bafybeiew5rivfqhu2ybj2tizl5bxsjz2czxyjb5xmcn7hg3dnqfrbya66m", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifju3pqlqtt4dmrmuvwy3h76pb3hycc2i2f336fs23hlkz5j4hw5u", "skill/valory/staking_abci/0.1.0": "bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta", - "agent/valory/trader/0.1.0": "bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy", - "service/valory/trader/0.1.0": "bafybeic63mv4jupowirlwlavyilo6s672cebshfmculoxrgu64ddyuvfny", - "service/valory/trader_pearl/0.1.0": "bafybeifwesumqtcqfj77zcxl3me7pow5h7yxedeoc4ukbi6dq5je4z7qjm" + "agent/valory/trader/0.1.0": "bafybeih2rxo7f2gwlo6tkryxvzweefjk2igg3ybq6liqopzdqoj36jmiku", + "service/valory/trader/0.1.0": "bafybeigqya5h77nztfbloqtfjlxgdmleyzfs3ze4spkunrc2cstfqvu6f4", + "service/valory/trader_pearl/0.1.0": "bafybeibogz3mcnykoypaa5iuruf7ltxotvgcv6kzlljlhgxto4gsnuxyby" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 1188197b4..4d9b1dab2 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifju3pqlqtt4dmrmuvwy3h76pb3hycc2i2f336fs23hlkz5j4hw5u - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi -- valory/trader_abci:0.1.0:bafybeibaypb67vs44u3zjj5egnztsckqkpffoaido54yjoqk7hrugfcuwu +- valory/decision_maker_abci:0.1.0:bafybeiah7epnjdxy7ogijjutirpk4dchb52p6k5paaonast3unvj62qmzq +- valory/trader_abci:0.1.0:bafybeiew5rivfqhu2ybj2tizl5bxsjz2czxyjb5xmcn7hg3dnqfrbya66m - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index d83051c43..945f9074c 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy +agent: valory/trader:0.1.0:bafybeih2rxo7f2gwlo6tkryxvzweefjk2igg3ybq6liqopzdqoj36jmiku number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 80f8db778..7a97107d0 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeibtlf2ju2ktpyt7loqt5npepm2ezm63sc54iw76mkyhvkch46ptoy +agent: valory/trader:0.1.0:bafybeih2rxo7f2gwlo6tkryxvzweefjk2igg3ybq6liqopzdqoj36jmiku number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index b8aa6dd0e..5f81b26b9 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -304,7 +304,6 @@ def _fetch_remote_tool_date(self) -> int: self.context.logger.info(f"Maximum date found: {max_transaction_date}") max_datetime = datetime.strptime(max_transaction_date, DATETIME_FORMAT_STR) unix_timestamp = int(max_datetime.timestamp()) - print(f"returning timestamp: {unix_timestamp}") return unix_timestamp self.context.logger.info("No maximum date found.") @@ -313,7 +312,7 @@ def _fetch_remote_tool_date(self) -> int: def _check_local_policy_store_overwrite(self) -> bool: """Compare the local and remote policy store dates and decide which to use.""" - local_policy_store_date = self._policy.updated_ts + local_policy_store_date = self.policy.updated_ts remote_policy_store_date = self._fetch_remote_tool_date() policy_store_update_offset = self.params.policy_store_update_offset diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 6af99c745..3650c0667 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,16 +25,16 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeiamzuntvgph7tgkxvoezdzip65vf6xnmu3vm5s6ftzqjzkj3zpqe4 + behaviours/storage_manager.py: bafybeiahltsqshgotl36jhskaysgvylvo2far6ukrt5e7jwxn5ubcwvcum behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a handlers.py: bafybeigod6gbjrxy4mbmulbzsbokeaoycoqys64vqtxnumishfukzf73za io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeihwg74syhibkg76vs45dvd3tm6iiyiicdncjuo6vzembwjz42o6ie + models.py: bafybeifhmwxoix5fqka4phtmv6324osei52zwirg3ogziondvlq33brnby payloads.py: bafybeicloiy4ax7dlipwp4czlueflgjgtlev4a6vhn2m7ztoehnemiiko4 - policy.py: bafybeict5loy6yymz6ta4lpt4v5qiy42sesanb23dfaqhagitcdnl3fmri + policy.py: bafybeihlzs4o5e7yfmfzcvvrzkf4bhxfsg5gxnzsrpepwgfugh45gafye4 redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm rounds.py: bafybeihczrvkid4lqoai7myqqs4f3g5diqsnjotxtqhxhm5c7oowzifbqy states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 9e42428b0..937a155a6 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicnmvvlcrqsqcbyhux4g2jxtkibgrjp7zr7h6welkfbthwerm4sau +- valory/decision_maker_abci:0.1.0:bafybeiah7epnjdxy7ogijjutirpk4dchb52p6k5paaonast3unvj62qmzq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifju3pqlqtt4dmrmuvwy3h76pb3hycc2i2f336fs23hlkz5j4hw5u - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 2bf450415..f751afb4a 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeiaqz3fonzyiaifqjpv2c4jlbqbo2vax6cjtivkvp7i2t7jr2vi5mi +- valory/decision_maker_abci:0.1.0:bafybeiah7epnjdxy7ogijjutirpk4dchb52p6k5paaonast3unvj62qmzq - valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From ad023f66709f4b58b501b2fc1bf0ccb2e77a030e Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Thu, 14 Nov 2024 15:58:34 +0000 Subject: [PATCH 15/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 8 ++++---- packages/valory/skills/trader_abci/skill.yaml | 8 ++++---- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 5f4a31cb4..3b5e186b8 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeiaizbnlz46lba6tcwmajpo2z37cpxuobeqmlgdqbdxnt65jr6rely", - "skill/valory/trader_abci/0.1.0": "bafybeido4dpfcvpyrobs2veoliuwaz2ltuzvo2gqfbsqxgd5tdr7zllyru", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeieszb6lxyy5gt4m4f75fjicuzf3ewsxgxcc5dh4l2tjjau7wcrgxe", + "skill/valory/decision_maker_abci/0.1.0": "bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m", + "skill/valory/trader_abci/0.1.0": "bafybeige67doi3tsjstkobsnafa2d5rqcm4tpw2vkej755t3knqhu3qdtq", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey", "skill/valory/staking_abci/0.1.0": "bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini", - "agent/valory/trader/0.1.0": "bafybeifaw3dk5uklcgj5iftcdhj4p2ymkidoli3uxibq4olddd3eboey7e", - "service/valory/trader/0.1.0": "bafybeiaqqlwqjiofrezpnk4hq6doiccbquzgmd6pcgtfx7akmfhhvyoipi", - "service/valory/trader_pearl/0.1.0": "bafybeidzv544ive2oozjk2szmengrcszea7ai54qts7ehdjdkwevwtwfba" + "agent/valory/trader/0.1.0": "bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay", + "service/valory/trader/0.1.0": "bafybeiasj27q7vwyqkxg4mcojrndzwhakoy3sd7o6ukee3sb4pdakzmu7e", + "service/valory/trader_pearl/0.1.0": "bafybeickeykdynteoeu7vcmmrz3gcf266qbryhkk6y5oilpdsrwcxhxp34" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 69cbddb85..f6ea1a0b3 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieszb6lxyy5gt4m4f75fjicuzf3ewsxgxcc5dh4l2tjjau7wcrgxe +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeiaizbnlz46lba6tcwmajpo2z37cpxuobeqmlgdqbdxnt65jr6rely -- valory/trader_abci:0.1.0:bafybeido4dpfcvpyrobs2veoliuwaz2ltuzvo2gqfbsqxgd5tdr7zllyru +- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m +- valory/trader_abci:0.1.0:bafybeige67doi3tsjstkobsnafa2d5rqcm4tpw2vkej755t3knqhu3qdtq - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 07147e807..c9abaa7e6 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifaw3dk5uklcgj5iftcdhj4p2ymkidoli3uxibq4olddd3eboey7e +agent: valory/trader:0.1.0:bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 25724b125..d997d61db 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeifaw3dk5uklcgj5iftcdhj4p2ymkidoli3uxibq4olddd3eboey7e +agent: valory/trader:0.1.0:bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index baf2897fd..7dedbbe88 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -17,7 +17,7 @@ fingerprint: behaviours/blacklisting.py: bafybeicqwj7o4l7qcym5xjqwq45jngqkhyf44mn6qise2ysyfnlnwz7pdy behaviours/check_benchmarking.py: bafybeiao2lyj7apezkqrpgsyzb3dwvrdgsrgtprf6iuhsmlsufvxfl5bci behaviours/claim_subscription.py: bafybeigbqkhc6mb73rbwaks32tfiqx6u2xza43uiy6rvbtrnqd6m4fru3e - behaviours/decision_receive.py: bafybeick7c5tfxcykisfmbzlu2ea32fg5ddqrhrexphuxqlh2ujim2gnse + behaviours/decision_receive.py: bafybeifb7aeu6g4xzmiyfc5ltipigsikfot3foux55gw5oaz2o5u5a4ume behaviours/decision_request.py: bafybeiabjzzcwcfbfmtoftjhewmkgbhxfnigbc5cwmmxl6cob5gv64jwwa behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm behaviours/order_subscription.py: bafybeicrmdvhci5prfldvuf3bclbbqi6j7lpv6hmphw3qwgmkmwat3od44 @@ -25,16 +25,16 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeibnlg2eirzcxdpnuwbhzne77ear44cqwm4yae5bacgfu4vqqq7d7a + behaviours/storage_manager.py: bafybeid4ref74rphfzpox4vbsfrhmo4i7vmvx6jk5pnjarogpn25xjrfbm behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a handlers.py: bafybeigod6gbjrxy4mbmulbzsbokeaoycoqys64vqtxnumishfukzf73za io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeicpwbvlrj4ag3kcbhjtp6ojvy4g5ggh7zjw47iwilmmhye72lt3fy + models.py: bafybeifhmwxoix5fqka4phtmv6324osei52zwirg3ogziondvlq33brnby payloads.py: bafybeicloiy4ax7dlipwp4czlueflgjgtlev4a6vhn2m7ztoehnemiiko4 - policy.py: bafybeihcltocxg7zsmvjtx44ilal4zir4fz2rupgmhacktzv5neb2lmas4 + policy.py: bafybeihlzs4o5e7yfmfzcvvrzkf4bhxfsg5gxnzsrpepwgfugh45gafye4 redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm rounds.py: bafybeihczrvkid4lqoai7myqqs4f3g5diqsnjotxtqhxhm5c7oowzifbqy states/__init__.py: bafybeid23llnyp6j257dluxmrnztugo5llsrog7kua53hllyktz4dqhqoy diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index b17af68d3..7aff8feac 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,10 +27,10 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeidcnpwi4o7z4wsenxz7tklagdchqunvmdqeyplcybwkoywmb7tvlu -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeicdzirkebpbyhhkhordyte3gup32yt4nyfpijqihtpmceryrr5o74 -- valory/staking_abci:0.1.0:bafybeifyqszbiccxwwfldrl6lz5dspuaxbqd5qnniyecusddwvxpfwiyr4 -- valory/check_stop_trading_abci:0.1.0:bafybeicsrrxjs6bup267jiek3r7eutd42ssfyjthyvxfku6qozw3xebxta +- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey +- valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne +- valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: main: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 717fed925..b699ddfdb 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeiaizbnlz46lba6tcwmajpo2z37cpxuobeqmlgdqbdxnt65jr6rely +- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From d38e7ab84a61602e73146e33e37aeb4a9f8ae714 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 12:38:20 +0000 Subject: [PATCH 16/23] fix if not accuracy_information --- .../behaviours/storage_manager.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 862c7307e..b52119e08 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -277,28 +277,28 @@ def _fetch_remote_tool_date(self) -> int: self.context.logger.info("Trying to read max date in file...") accuracy_information = self.accuracy_information + max_transaction_date = None + if accuracy_information: sep = self.acc_info_fields.sep accuracy_information.seek(0) # Ensure we’re at the beginning reader = csv.DictReader(accuracy_information.readlines(), delimiter=sep) - max_transaction_date = None - - # try to read the maximum transaction date in the remote accuracy info - try: - for row in reader: - current_transaction_date = row.get(MAX_STR) - if ( - max_transaction_date is None - or current_transaction_date > max_transaction_date - ): - max_transaction_date = current_transaction_date - - except TypeError: - self.context.logger.warning( - "Invalid transaction date found. Continuing with local accuracy information..." - ) - return 0 + # try to read the maximum transaction date in the remote accuracy info + try: + for row in reader: + current_transaction_date = row.get(MAX_STR) + if ( + max_transaction_date is None + or current_transaction_date > max_transaction_date + ): + max_transaction_date = current_transaction_date + + except TypeError: + self.context.logger.warning( + "Invalid transaction date found. Continuing with local accuracy information..." + ) + return 0 if max_transaction_date: self.context.logger.info(f"Maximum date found: {max_transaction_date}") From d954db0c5495724c9605fa12a5e7130733f90dde Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 13:28:20 +0000 Subject: [PATCH 17/23] fix policy_store_update_offset not overridden at service level --- packages/valory/services/trader/service.yaml | 1 + packages/valory/services/trader_pearl/service.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index c9abaa7e6..fc059d028 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -144,6 +144,7 @@ type: skill safe_voting_range: ${SAFE_VOTING_RANGE:int:600} rebet_chance: ${REBET_CHANCE:float:0.6} mech_interaction_sleep_time: ${MECH_INTERACTION_SLEEP_TIME:int:10} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} benchmark_tool: &id004 args: log_dir: ${LOG_DIR:str:/benchmarks} diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index d997d61db..348812784 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -102,6 +102,7 @@ models: priority_mech_service_id: ${PRIORITY_MECH_SERVICE_ID:int:0} requester_staking_instance_address: ${REQUESTER_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} response_timeout: ${RESPONSE_TIMEOUT:int:300} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} benchmark_tool: args: log_dir: /benchmarks From 6b07270111937ab7f135dedf0676259007b9806b Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 13:29:47 +0000 Subject: [PATCH 18/23] remove elif is_first_period --- .../behaviours/storage_manager.py | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index b52119e08..6223dfd12 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -61,7 +61,7 @@ def __init__(self, **kwargs: Any) -> None: self._mech_hash: str = "" self._utilized_tools: Dict[str, str] = {} self._mech_tools: Optional[List[str]] = None - self._accuracy_information: StringIO = StringIO() + self._remote_accuracy_information: StringIO = StringIO() @property def mech_tools(self) -> List[str]: @@ -76,14 +76,14 @@ def mech_tools(self, mech_tools: List[str]) -> None: self._mech_tools = mech_tools @property - def accuracy_information(self) -> StringIO: + def remote_accuracy_information(self) -> StringIO: """Get the accuracy information.""" - return self._accuracy_information + return self._remote_accuracy_information - @accuracy_information.setter - def accuracy_information(self, accuracy_information: StringIO) -> None: + @remote_accuracy_information.setter + def remote_accuracy_information(self, accuracy_information: StringIO) -> None: """Set the accuracy information.""" - self._accuracy_information = accuracy_information + self._remote_accuracy_information = accuracy_information @property def mech_id(self) -> int: @@ -261,7 +261,7 @@ def _fetch_accuracy_info(self) -> Generator[None, None, bool]: self.context.logger.info("Parsing accuracy information of the tools...") try: - self.accuracy_information = StringIO(response.body.decode()) + self.remote_accuracy_information = StringIO(response.body.decode()) except (ValueError, TypeError) as e: self.context.logger.error( f"Could not parse response from ipfs server, " @@ -275,7 +275,7 @@ def _fetch_remote_tool_date(self) -> int: """Fetch the max transaction date from the remote accuracy storage.""" self.context.logger.info("Checking remote accuracy information date... ") self.context.logger.info("Trying to read max date in file...") - accuracy_information = self.accuracy_information + accuracy_information = self.remote_accuracy_information max_transaction_date = None @@ -332,7 +332,7 @@ def _update_accuracy_store(self) -> None: self.context.logger.info("Updating accuracy information of the policy...") sep = self.acc_info_fields.sep reader: csv.DictReader = csv.DictReader( - self.accuracy_information, delimiter=sep + self.remote_accuracy_information, delimiter=sep ) accuracy_store = self.policy.accuracy_store @@ -381,10 +381,6 @@ def _set_policy(self) -> Generator: self.policy.updated_ts = int(datetime.now().timestamp()) self._update_accuracy_store() - elif self.is_first_period: - policy_json = json.dumps(self.policy, cls=DataclassEncoder) - self.accuracy_information = StringIO(policy_json) - def _try_recover_utilized_tools(self) -> Dict[str, str]: """Try to recover the utilized tools from the tools store.""" tools_path = self.params.store_path / UTILIZED_TOOLS_STORE From 134b4ca0e580021bdcedaff38eb635c800017202 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 13:30:39 +0000 Subject: [PATCH 19/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 3b5e186b8..4c4916121 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m", - "skill/valory/trader_abci/0.1.0": "bafybeige67doi3tsjstkobsnafa2d5rqcm4tpw2vkej755t3knqhu3qdtq", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e", + "skill/valory/trader_abci/0.1.0": "bafybeickkcug5xelguwdgh2plfindvstx64fkwztzjubnnlhxrn7qhcfu4", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q", "skill/valory/staking_abci/0.1.0": "bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini", - "agent/valory/trader/0.1.0": "bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay", - "service/valory/trader/0.1.0": "bafybeiasj27q7vwyqkxg4mcojrndzwhakoy3sd7o6ukee3sb4pdakzmu7e", - "service/valory/trader_pearl/0.1.0": "bafybeickeykdynteoeu7vcmmrz3gcf266qbryhkk6y5oilpdsrwcxhxp34" + "agent/valory/trader/0.1.0": "bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy", + "service/valory/trader/0.1.0": "bafybeifjf376limhj6b5uxu4kjh7pkg7rusg4h3pqjhhblryiwdgfgnxae", + "service/valory/trader_pearl/0.1.0": "bafybeibogs26thbnisbpz5jfqhm2qgyhtb5kn7sop7sdwh6wlhot4tfj2q" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index f6ea1a0b3..7af152bb5 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m -- valory/trader_abci:0.1.0:bafybeige67doi3tsjstkobsnafa2d5rqcm4tpw2vkej755t3knqhu3qdtq +- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e +- valory/trader_abci:0.1.0:bafybeickkcug5xelguwdgh2plfindvstx64fkwztzjubnnlhxrn7qhcfu4 - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index fc059d028..c56d92a6b 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay +agent: valory/trader:0.1.0:bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 348812784..0c6b75cad 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeialurh44ecpu5wgttfgv2ofmrmzgyxuok4utdxucp4mbqnp7nspay +agent: valory/trader:0.1.0:bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 7dedbbe88..f298f3fe1 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeid4ref74rphfzpox4vbsfrhmo4i7vmvx6jk5pnjarogpn25xjrfbm + behaviours/storage_manager.py: bafybeiddpvpynn5plcwiwo7rnaj2ll6rw5iyro24juz52bz2k4popcmvri behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 7aff8feac..b9b22310e 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigkuozh6m4l6qrvott7olopblaiezqlbq2geaqplb5lzspyo2v2ey +- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index b699ddfdb..e31689710 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeif7mb7jzcxm2jowee53avcljgfjlzzixq3u5fgwa75ga3ikol2g3m +- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From 31930a159cb4bc2ea6d04c9e5e42dd9909aebb59 Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 13:35:35 +0000 Subject: [PATCH 20/23] remove unused import --- .../skills/decision_maker_abci/behaviours/storage_manager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py index 6223dfd12..e4b5845df 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/storage_manager.py @@ -37,7 +37,6 @@ from packages.valory.skills.decision_maker_abci.models import AgentToolsSpecs from packages.valory.skills.decision_maker_abci.policy import ( AccuracyInfo, - DataclassEncoder, EGreedyPolicy, ) From acf1e8f5146e17b73e6e83c3097461826959f49a Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 13:35:44 +0000 Subject: [PATCH 21/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 4c4916121..f19aadbd8 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e", - "skill/valory/trader_abci/0.1.0": "bafybeickkcug5xelguwdgh2plfindvstx64fkwztzjubnnlhxrn7qhcfu4", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q", + "skill/valory/decision_maker_abci/0.1.0": "bafybeifjqmvhf7ebfxs44kjf7kfyzdpssbn3fohncpacbj77kfhgnkga2a", + "skill/valory/trader_abci/0.1.0": "bafybeiensqr7urodludpraivid6pu237yl5mpr6kmylrqacxlkfibbzz34", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidpbpu4q77z7xtxu5il5lsyr5ktgfm2x35zgnleapgna432zxuqx4", "skill/valory/staking_abci/0.1.0": "bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini", - "agent/valory/trader/0.1.0": "bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy", - "service/valory/trader/0.1.0": "bafybeifjf376limhj6b5uxu4kjh7pkg7rusg4h3pqjhhblryiwdgfgnxae", - "service/valory/trader_pearl/0.1.0": "bafybeibogs26thbnisbpz5jfqhm2qgyhtb5kn7sop7sdwh6wlhot4tfj2q" + "agent/valory/trader/0.1.0": "bafybeigfr2hur6duw3xdbhzsco7amw6kwk6rhydppdw5kheohyimpy2w4i", + "service/valory/trader/0.1.0": "bafybeidgbgntgfjexq7yrfttlzhm2dxeaokwpzy7hp7r5an6fdirsd4vu4", + "service/valory/trader_pearl/0.1.0": "bafybeiaibltgsu7yv7l5wppn775fbgcixxx754uctnntt2e5tzdiywtryy" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 7af152bb5..8312717a0 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidpbpu4q77z7xtxu5il5lsyr5ktgfm2x35zgnleapgna432zxuqx4 - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e -- valory/trader_abci:0.1.0:bafybeickkcug5xelguwdgh2plfindvstx64fkwztzjubnnlhxrn7qhcfu4 +- valory/decision_maker_abci:0.1.0:bafybeifjqmvhf7ebfxs44kjf7kfyzdpssbn3fohncpacbj77kfhgnkga2a +- valory/trader_abci:0.1.0:bafybeiensqr7urodludpraivid6pu237yl5mpr6kmylrqacxlkfibbzz34 - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index c56d92a6b..bcd2ccebb 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy +agent: valory/trader:0.1.0:bafybeigfr2hur6duw3xdbhzsco7amw6kwk6rhydppdw5kheohyimpy2w4i number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 0c6b75cad..4b4983160 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeiah33wpjjetvs6yuaoxfdjbnkvzco3g5tlsj2dilsb752vx65qrmy +agent: valory/trader:0.1.0:bafybeigfr2hur6duw3xdbhzsco7amw6kwk6rhydppdw5kheohyimpy2w4i number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index f298f3fe1..a128712c6 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -25,7 +25,7 @@ fingerprint: behaviours/reedem.py: bafybeiaxwp4lx62owcaqfp6xcqh6567f5yvwnl4rage2f5hmq4nltkzjjy behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i behaviours/sampling.py: bafybeiekxzublnsvgjb2y2uvtye4zkethvmsxh4itonnwmb3sbviyyhsgq - behaviours/storage_manager.py: bafybeiddpvpynn5plcwiwo7rnaj2ll6rw5iyro24juz52bz2k4popcmvri + behaviours/storage_manager.py: bafybeignur4cwwkdmoj33ll3pmylnddbaqd6gpn6m2n7idieyyti7m3jg4 behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeiabt2fonv63hozgr7bt4d5auom76iufzh6etpnmbwekktckz7644a diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index b9b22310e..c3948500d 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeia54rhfllugehtbiuuiu2336c6rmj7qvmrk6fvz3gysn6khlvxs3q +- valory/decision_maker_abci:0.1.0:bafybeifjqmvhf7ebfxs44kjf7kfyzdpssbn3fohncpacbj77kfhgnkga2a +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidpbpu4q77z7xtxu5il5lsyr5ktgfm2x35zgnleapgna432zxuqx4 - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index e31689710..75f4559cc 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeiemoyt4dvh5e4b3y3exa3nsy5kw3lqjmstqt7fuq35swudb2avo2e +- valory/decision_maker_abci:0.1.0:bafybeifjqmvhf7ebfxs44kjf7kfyzdpssbn3fohncpacbj77kfhgnkga2a - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: From 5cce568def04d2a7258c651c2be5462bcc8d26dd Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 15:24:21 +0000 Subject: [PATCH 22/23] policy_store_update_offset override --- packages/packages.json | 2 +- packages/valory/services/trader/service.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/packages.json b/packages/packages.json index f19aadbd8..cac4cd95b 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -22,7 +22,7 @@ "skill/valory/staking_abci/0.1.0": "bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini", "agent/valory/trader/0.1.0": "bafybeigfr2hur6duw3xdbhzsco7amw6kwk6rhydppdw5kheohyimpy2w4i", - "service/valory/trader/0.1.0": "bafybeidgbgntgfjexq7yrfttlzhm2dxeaokwpzy7hp7r5an6fdirsd4vu4", + "service/valory/trader/0.1.0": "bafybeigrg4shbp6axt22hpxszdj2vxjy435hrk3jhnv7sstblsfi3idlni", "service/valory/trader_pearl/0.1.0": "bafybeiaibltgsu7yv7l5wppn775fbgcixxx754uctnntt2e5tzdiywtryy" }, "third_party": { diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index bcd2ccebb..93ee7b0b2 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -367,6 +367,7 @@ type: skill safe_voting_range: ${SAFE_VOTING_RANGE:int:600} rebet_chance: ${REBET_CHANCE:float:0.6} mech_interaction_sleep_time: ${MECH_INTERACTION_SLEEP_TIME:int:10} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} benchmark_tool: *id004 acc_info_fields: *id005 network_subgraph: *id006 @@ -483,6 +484,7 @@ type: skill safe_voting_range: ${SAFE_VOTING_RANGE:int:600} rebet_chance: ${REBET_CHANCE:float:0.6} mech_interaction_sleep_time: ${MECH_INTERACTION_SLEEP_TIME:int:10} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} benchmark_tool: *id004 acc_info_fields: *id005 network_subgraph: *id006 @@ -599,6 +601,7 @@ type: skill safe_voting_range: ${SAFE_VOTING_RANGE:int:600} rebet_chance: ${REBET_CHANCE:float:0.6} mech_interaction_sleep_time: ${MECH_INTERACTION_SLEEP_TIME:int:10} + policy_store_update_offset: ${POLICY_STORE_UPDATE_OFFSET:int:259200} benchmark_tool: *id004 acc_info_fields: *id005 network_subgraph: *id006 From 1e23ec2b0b66311e3fb7185d26aebaae2208344a Mon Sep 17 00:00:00 2001 From: Anna Sambrook Date: Fri, 15 Nov 2024 15:36:58 +0000 Subject: [PATCH 23/23] chore: generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 6 +++--- packages/valory/services/trader/service.yaml | 2 +- packages/valory/services/trader_pearl/service.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 4 ++-- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index a189b2c53..7545d9636 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -16,14 +16,14 @@ "contract/valory/staking_token/0.1.0": "bafybeiep4r6qyilbfgzdvx6t7zvpgaioxqktmxm7puwtnbpb2ftlib43gy", "contract/valory/relayer/0.1.0": "bafybeicawmds6czx7db2lcktvexwrp245jpekgulndtos5s5zdid3ilvq4", "skill/valory/market_manager_abci/0.1.0": "bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka", - "skill/valory/decision_maker_abci/0.1.0": "bafybeia5qzqac2g444myog3tlwagthcknmanqunnytbjfsuk2msep2rnna", - "skill/valory/trader_abci/0.1.0": "bafybeigz6mm7xzhe334iuyy6nw4tdymxfjp6fp37firbzznxg7mowtvcoe", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigt42cdisy2z53u5pqq3qmjk5bb32cm5oegftptv56m7yq5dbdoyi", + "skill/valory/decision_maker_abci/0.1.0": "bafybeies6fzgumlvqvxs2hl2ib5sogid5pxyyuvdlyahobtfxnekyxlb4a", + "skill/valory/trader_abci/0.1.0": "bafybeiduheiehpzyhh4jccdqno3bu3wmmmuoi5udewky3jjzyncbqee35a", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeieu2l6dkg53f5eyvuttk2xywe3uln2h4n6uoadpoariznejoizj7a", "skill/valory/staking_abci/0.1.0": "bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne", "skill/valory/check_stop_trading_abci/0.1.0": "bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini", - "agent/valory/trader/0.1.0": "bafybeidcn54f67yhqaa7aycsmurm4tvmx2dj2e2zir6keft3ubxchcu6hu", - "service/valory/trader/0.1.0": "bafybeig6jsofnzrst72r3qannxrpbrbfd7c4nvdcvacsplcx7gnyroqeuu", - "service/valory/trader_pearl/0.1.0": "bafybeih456qaxmfhx7bhhk2wdzjq4s3mbxmkfdveyucgwdh7ilqio4ruvm" + "agent/valory/trader/0.1.0": "bafybeie52jxu5w4xuoiy3ottfdojnr6pism6xiaat4vipj56mhs2paa2uu", + "service/valory/trader/0.1.0": "bafybeies7dwitrixe2ooxyapkd5zagzb47c44wgok5zjlcmosjdqco6uf4", + "service/valory/trader_pearl/0.1.0": "bafybeiejqghxhnskc2gecekjc4eth2yg4csd2af6uhboa3vvqpvwdtjdgq" }, "third_party": { "protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 74d86955a..2c40203b5 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -45,10 +45,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeigrdlxed3xlsnxtjhnsbl3cojruihxcqx4jxhgivkd5i2fkjncgba - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigt42cdisy2z53u5pqq3qmjk5bb32cm5oegftptv56m7yq5dbdoyi +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieu2l6dkg53f5eyvuttk2xywe3uln2h4n6uoadpoariznejoizj7a - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeia5qzqac2g444myog3tlwagthcknmanqunnytbjfsuk2msep2rnna -- valory/trader_abci:0.1.0:bafybeigz6mm7xzhe334iuyy6nw4tdymxfjp6fp37firbzznxg7mowtvcoe +- valory/decision_maker_abci:0.1.0:bafybeies6fzgumlvqvxs2hl2ib5sogid5pxyyuvdlyahobtfxnekyxlb4a +- valory/trader_abci:0.1.0:bafybeiduheiehpzyhh4jccdqno3bu3wmmmuoi5udewky3jjzyncbqee35a - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 8eb3ab688..aabeb52ac 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidcn54f67yhqaa7aycsmurm4tvmx2dj2e2zir6keft3ubxchcu6hu +agent: valory/trader:0.1.0:bafybeie52jxu5w4xuoiy3ottfdojnr6pism6xiaat4vipj56mhs2paa2uu number_of_agents: 4 deployment: agent: diff --git a/packages/valory/services/trader_pearl/service.yaml b/packages/valory/services/trader_pearl/service.yaml index 3d1ddf3b9..38fa27857 100644 --- a/packages/valory/services/trader_pearl/service.yaml +++ b/packages/valory/services/trader_pearl/service.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e fingerprint_ignore_patterns: [] -agent: valory/trader:0.1.0:bafybeidcn54f67yhqaa7aycsmurm4tvmx2dj2e2zir6keft3ubxchcu6hu +agent: valory/trader:0.1.0:bafybeie52jxu5w4xuoiy3ottfdojnr6pism6xiaat4vipj56mhs2paa2uu number_of_agents: 1 deployment: agent: diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index e54e5d02c..9db69cc89 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -27,8 +27,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeic7q7recyka272udwcupblwbkc3jkodgp74fvcdxb7urametg5dae - valory/termination_abci:0.1.0:bafybeib5l7jhew5ic6iq24dd23nidcoimzqkrk556gqywhoziatj33zvwm - valory/market_manager_abci:0.1.0:bafybeicia7itulcrxlwbmhfzxppgo5i33tb2nmcycwizftw7gps4dareka -- valory/decision_maker_abci:0.1.0:bafybeia5qzqac2g444myog3tlwagthcknmanqunnytbjfsuk2msep2rnna -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigt42cdisy2z53u5pqq3qmjk5bb32cm5oegftptv56m7yq5dbdoyi +- valory/decision_maker_abci:0.1.0:bafybeies6fzgumlvqvxs2hl2ib5sogid5pxyyuvdlyahobtfxnekyxlb4a +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieu2l6dkg53f5eyvuttk2xywe3uln2h4n6uoadpoariznejoizj7a - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/check_stop_trading_abci:0.1.0:bafybeifmi64g4ki6zwbcncb35ovhd4sllw4xrszrkturpeqdhgf5bkiini - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 285b700cc..1c7ce8bb6 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -23,7 +23,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni skills: - valory/abstract_round_abci:0.1.0:bafybeib733xfbndtpvkf44mtk7oyodnficgloo6xhn7xmqxxeos33es65u -- valory/decision_maker_abci:0.1.0:bafybeia5qzqac2g444myog3tlwagthcknmanqunnytbjfsuk2msep2rnna +- valory/decision_maker_abci:0.1.0:bafybeies6fzgumlvqvxs2hl2ib5sogid5pxyyuvdlyahobtfxnekyxlb4a - valory/staking_abci:0.1.0:bafybeictd5pxhscuhqntvctb7l5lfjausxt2m22rg5mkaiuj4cwwcxpvne - valory/mech_interact_abci:0.1.0:bafybeid6m3i5ofq7vuogqapdnoshhq7mswmudhvfcr2craw25fdwtoe3lm behaviours: