Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/benchmarking convergence #382

Merged
merged 37 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
48eea38
add: mech calls limit for benchmarking
keshav1998 Dec 10, 2024
7a9f8d2
add: sampling logic for benchmarking
keshav1998 Dec 10, 2024
aae6f35
add: bet transaction update for benchmarking
keshav1998 Dec 10, 2024
d45a560
update: queue transition for benchmarking round
keshav1998 Dec 10, 2024
498d2bc
add: counting for mocked mech calls
keshav1998 Dec 10, 2024
0d50b38
add: check if mech calls reached in benchmarking
keshav1998 Dec 10, 2024
6443798
update: blacklisting behaviour for benchmarking
keshav1998 Dec 10, 2024
f625040
add: call count update
keshav1998 Dec 10, 2024
dd05bea
chore: generate hashes
keshav1998 Dec 10, 2024
b87e58c
revert: benchmarking changes for blacklisting
keshav1998 Dec 10, 2024
359686b
update: bet to benchmarking done if no mock
keshav1998 Dec 10, 2024
3121120
add: benchmarking done queue status
keshav1998 Dec 10, 2024
da13f49
add: reprocessed bets to be considered
keshav1998 Dec 10, 2024
05a83a3
add: mech calls reset for benchmarking
keshav1998 Dec 12, 2024
7591ce2
fix: `nr_mech_calls` default value in service params
cyberosa Dec 12, 2024
58a4744
fix: handle queue status conversion
keshav1998 Dec 12, 2024
a983b01
chore: remove unnecessary code
Adamantios Jan 10, 2025
a7e01fd
chore: run generators
Adamantios Jan 10, 2025
aef018e
chore: ignore `gitleaks` report for irrelevant files
Adamantios Jan 13, 2025
1f63cc0
update: remove unnecessary id checks
annasambrook Jan 17, 2025
19a9c23
chore: generators
annasambrook Jan 17, 2025
29bf8b3
adding extra case in BetsDecoder to parse bets.json file
cyberosa Jan 21, 2025
ef24893
Merge remote-tracking branch 'refs/remotes/origin/develop' into feat/…
annasambrook Jan 30, 2025
c879d66
fix: BENCHMARKING_FINISHED to BenchmarkingDoneRound
annasambrook Jan 30, 2025
326a295
chore: generators
annasambrook Jan 30, 2025
873a1fe
chore: generators
annasambrook Jan 30, 2025
4dba30c
add: exclude erc20 from generators and common checks
annasambrook Jan 30, 2025
19f1fbf
add: comments for bets decoder
annasambrook Feb 5, 2025
34d310a
chore: generators
annasambrook Feb 5, 2025
bf08801
chore: generators
annasambrook Feb 6, 2025
65f5073
Merge branch 'refs/heads/develop' into feat/benchmarking-convergence
annasambrook Feb 14, 2025
12836ec
chore: generators
annasambrook Feb 14, 2025
222da08
removing commit from git history
cyberosa Feb 19, 2025
a83b379
Merge branch 'develop' into feat/benchmarking-convergence
cyberosa Feb 19, 2025
4cfc32e
moving benchmarking params to market manager skill and updating gitig…
cyberosa Feb 19, 2025
043583f
removing parenthesis
cyberosa Feb 19, 2025
d3ff417
updating hashes
cyberosa Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,19 @@ ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/trader_abci/skil
0b4170ce2e876c28a9585081117e6468db17f0b9:packages/valory/services/trader_omen_gnosis/service.yaml:generic-api-key:48
518f4ec1e1b80f45420c3626613833a27b0aab5d:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:263
0c54647f03886d75fca4522420ea72b58d6c3dcc:packages/valory/skills/market_manager_abci/behaviours.py:generic-api-key:59
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/log.txt:generic-api-key:176
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/log.txt:generic-api-key:352
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/log.txt:generic-api-key:939
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/log.txt:generic-api-key:1243
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/connections/http_server/tests/data/certs/server.key:RSA-PK:1
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:216
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:239
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/skills/mech_interact_abci/skill.yaml:generic-api-key:152
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/skills/trader_abci/skill.yaml:generic-api-key:159
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_backup/vendor/valory/skills/trader_abci/skill.yaml:generic-api-key:170
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/connections/http_server/tests/data/certs/server.key:RSA-PK:1
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:216
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:239
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/skills/mech_interact_abci/skill.yaml:generic-api-key:152
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/skills/trader_abci/skill.yaml:generic-api-key:159
7cb24a6ba2423f65a946b163268d09308ca00a00:trader_old/vendor/valory/skills/trader_abci/skill.yaml:generic-api-key:170
14 changes: 7 additions & 7 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"contract/valory/mech_activity/0.1.0": "bafybeieadv7vnbguc7beu6xo3rs3mqbgzc7wayc7kvgb2tmitmjtpdcqkq",
"contract/valory/staking_token/0.1.0": "bafybeiaynt6clwbthtbndtocnwul7dp76ctmu4jxinp7fnqks4pxt65yuy",
"contract/valory/relayer/0.1.0": "bafybeicreijhjycqrutdpbdn3vdcpmo233y3p66l3ovmr2goa2y2e6bshy",
"skill/valory/market_manager_abci/0.1.0": "bafybeiayhzwxlpqsevyvaxn6dtnnu745az5vcz7dckmghnmjywxdtvoyly",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifod6ghdpzqtsvxntb3ebjer3wbduv6pzw3qxlepcl7o3j5yrl34i",
"skill/valory/trader_abci/0.1.0": "bafybeidgezontxf7hj4czqbdnn54o44zppp3b63epojm3ry6glzpdf4jrq",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibj5frl64wbrq2skp324opcukakvuawbg5cia2svrbnsmiyfrai4u",
"skill/valory/market_manager_abci/0.1.0": "bafybeidt6wx527mmmpadbkxjl57uugprmgtuskvkiutvtzo7op6lkarnea",
"skill/valory/decision_maker_abci/0.1.0": "bafybeicovkcvoedtfqbylelwfjrmcnuedbhb4min7dkux2egy7s4wog5km",
"skill/valory/trader_abci/0.1.0": "bafybeihs27rjca5eax3g6xn7eaxbuhmvwks2xey6ihn63nc73wvdnym7ia",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeieh3z7mp67k5i4k7te45ahnsudhxzom5z2klbreizsovoinkx7tcm",
"skill/valory/staking_abci/0.1.0": "bafybeiaasclr4lf3u2layekmfwyasckxrslbs2g4me7kvozz5goswlznjq",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeic3bismocli2yyxmjhjsevjbzpuf3ladsvlkazfx23vq3q6uxrn7m",
"agent/valory/trader/0.1.0": "bafybeihuzkr2gnkwuriaxqmxus7kdzviykzwov6cx6czbuvibgqlrtyqoe",
"service/valory/trader/0.1.0": "bafybeihx4hmeemnntm4s5tljmu2ovzlsdlhawno5a6sirk3ckopghqhuxm",
"service/valory/trader_pearl/0.1.0": "bafybeiakci4w647tctffeq26snbnoh2yaqycyh5xobuxytpbbvsod6qodi"
"agent/valory/trader/0.1.0": "bafybeia4x7cj5vy6pkwoiov65nxviqdqxcipgqrboqwcf76ww4ymrojohq",
"service/valory/trader/0.1.0": "bafybeidbewj4cofphxhnb6jeczg26wfpbyhe7e6pq7w6sezqpyiibqfbwi",
"service/valory/trader_pearl/0.1.0": "bafybeiajcuwa7flzc5oayujpz2mqzuvrxbuniru3g4izehtkjixoo766vq"
},
"third_party": {
"protocol/valory/acn_data_share/0.1.0": "bafybeidbvo3jdbt54pqk3foqfso4uim2vaea5abg6jzktomdeklh6sm2rq",
Expand Down
9 changes: 5 additions & 4 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiezfedmmseox3ce5aucxsiszdmvskrwwbtpb2a3vw3sbmc5jt7nri
- valory/termination_abci:0.1.0:bafybeiea67epwwgngp7b3wavs6hpkaxv6etyaps6g6325bchfnf354mibq
- valory/transaction_settlement_abci:0.1.0:bafybeifmgmwdkx4esemxjacjwzqkqymkuklb5nehkwqkx7v335fllgswcq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibj5frl64wbrq2skp324opcukakvuawbg5cia2svrbnsmiyfrai4u
- valory/market_manager_abci:0.1.0:bafybeiayhzwxlpqsevyvaxn6dtnnu745az5vcz7dckmghnmjywxdtvoyly
- valory/decision_maker_abci:0.1.0:bafybeifod6ghdpzqtsvxntb3ebjer3wbduv6pzw3qxlepcl7o3j5yrl34i
- valory/trader_abci:0.1.0:bafybeidgezontxf7hj4czqbdnn54o44zppp3b63epojm3ry6glzpdf4jrq
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeieh3z7mp67k5i4k7te45ahnsudhxzom5z2klbreizsovoinkx7tcm
- valory/market_manager_abci:0.1.0:bafybeidt6wx527mmmpadbkxjl57uugprmgtuskvkiutvtzo7op6lkarnea
- valory/decision_maker_abci:0.1.0:bafybeicovkcvoedtfqbylelwfjrmcnuedbhb4min7dkux2egy7s4wog5km
- valory/trader_abci:0.1.0:bafybeihs27rjca5eax3g6xn7eaxbuhmvwks2xey6ihn63nc73wvdnym7ia
- valory/staking_abci:0.1.0:bafybeiaasclr4lf3u2layekmfwyasckxrslbs2g4me7kvozz5goswlznjq
- valory/check_stop_trading_abci:0.1.0:bafybeic3bismocli2yyxmjhjsevjbzpuf3ladsvlkazfx23vq3q6uxrn7m
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
Expand Down Expand Up @@ -267,6 +267,7 @@ models:
bet_amount_field: ${str:collateral_amount}
results_filename: ${str:benchmarking_results.csv}
randomness: ${str:benchmarking_randomness}
nr_mech_calls: ${int:60}
acc_info_fields:
args:
tool: ${str:tool}
Expand Down
3 changes: 2 additions & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeihuzkr2gnkwuriaxqmxus7kdzviykzwov6cx6czbuvibgqlrtyqoe
agent: valory/trader:0.1.0:bafybeia4x7cj5vy6pkwoiov65nxviqdqxcipgqrboqwcf76ww4ymrojohq
number_of_agents: 4
deployment:
agent:
Expand Down Expand Up @@ -172,6 +172,7 @@ type: skill
bet_amount_field: ${BENCHMARKING_MODE_BET_AMOUNT_FIELD:str:collateral_amount}
results_filename: ${BENCHMARKING_MODE_RESULTS_FILENAME:str:benchmarking_results.csv}
randomness: ${BENCHMARKING_MODE_RANDOMNESS:str:benchmarking_randomness}
nr_mech_calls: ${BENCHMARKING_MECH_CALLS:int:60}
acc_info_fields: &id004
args:
tool: ${ACC_INFO_FIELDS_TOOL:str:tool}
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader_pearl/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeibg7bdqpioh4lmvknw3ygnllfku32oca4eq5pqtvdrdsgw6buko7e
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeihuzkr2gnkwuriaxqmxus7kdzviykzwov6cx6czbuvibgqlrtyqoe
agent: valory/trader:0.1.0:bafybeia4x7cj5vy6pkwoiov65nxviqdqxcipgqrboqwcf76ww4ymrojohq
number_of_agents: 1
deployment:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def async_act(self) -> Generator:
if self.benchmarking_mode.enabled:
# simulate the bet placement
with self.context.benchmark_tool.measure(self.behaviour_id).local():
self.update_bet_transaction_information()
payload = BetPlacementPayload(
agent, None, None, True, self.wallet_balance
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
# Copyright 2023-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -49,6 +49,7 @@
P_NO_FIELD,
P_YES_FIELD,
PredictionResponse,
QueueStatus,
)
from packages.valory.skills.mech_interact_abci.states.base import (
MechInteractionResponse,
Expand Down Expand Up @@ -126,6 +127,7 @@ def _next_dataset_row(self) -> Optional[Dict[str, str]]:
else:
# no more bets available for this market
msg = f"No more mock responses for the market with id: {sampled_bet_id}"
self.sampled_bet.queue_status = QueueStatus.BENCHMARKING_DONE
self.context.logger.info(msg)
self.shared_state.last_benchmarking_has_run = True
self._rows_exceeded = True
Expand Down Expand Up @@ -514,6 +516,9 @@ def _is_profitable(
else:
self._write_benchmark_results(prediction_response)

self.context.logger.info("Increasing Mech call count by 1")
self.shared_state.benchmarking_mech_calls += 1

return is_profitable, bet_amount

def _update_selected_bet(
Expand Down Expand Up @@ -569,6 +574,8 @@ def async_act(self) -> Generator:
prediction_response,
bet_amount,
)
self.context.logger.info("Increasing Mech call count by 1")
self.shared_state.benchmarking_mech_calls += 1

if prediction_response is not None:
self.policy.tool_responded(
Expand Down
35 changes: 35 additions & 0 deletions packages/valory/skills/decision_maker_abci/behaviours/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,31 @@ def _sampled_bet_idx(self, bets: List[Bet]) -> int:

return self.bets.index(sorted_bets[0])

def _sampling_benchmarking_bet(self, bets: List[Bet]) -> Optional[int]:
"""Sample bet for benchmarking"""
to_process_bets, processed_bets, reprocessed_bets = self._get_bets_queue_wise(
bets
)

self.context.logger.info(f"TO_PROCESS_LEN: {len(to_process_bets)}")
self.context.logger.info(f"PROCESSED_LEN: {len(processed_bets)}")
self.context.logger.info(f"REPROCESSED_LEN: {len(reprocessed_bets)}")

self.context.logger.info(
f"MECH CALLS MADE: {self.shared_state.benchmarking_mech_calls}"
)

if (
self.shared_state.benchmarking_mech_calls
== self.benchmarking_mode.nr_mech_calls
):
return None

bets_to_sort: List[Bet] = to_process_bets or processed_bets or reprocessed_bets
sorted_bets = self._sort_by_priority_logic(bets_to_sort)

return self.bets.index(sorted_bets[0])

def _sample(self) -> Optional[int]:
"""Sample a bet, mark it as processed, and return its index."""
# modify time "NOW" in benchmarking mode
Expand All @@ -164,6 +189,11 @@ def _sample(self) -> Optional[int]:
self.context.logger.warning(msg)
return None

if self.benchmarking_mode.enabled:
idx = self._sampling_benchmarking_bet(available_bets)
if not idx:
return None

# sample a bet using the priority logic
idx = self._sampled_bet_idx(available_bets)
sampled_bet = self.bets[idx]
Expand All @@ -190,6 +220,8 @@ def _benchmarking_inc_day(self) -> Tuple[bool, bool]:
if benchmarking_finished:
self.context.logger.info("No more days to simulate in benchmarking mode.")

self.shared_state.benchmarking_mech_calls = 0

day_increased = True

return benchmarking_finished, day_increased
Expand All @@ -204,6 +236,9 @@ def async_act(self) -> Generator:
# day increase simulation and benchmarking finished check
if idx is None and self.benchmarking_mode.enabled:
benchmarking_finished, day_increased = self._benchmarking_inc_day()
for bet in self.bets:
bet.queue_status = bet.queue_status.move_to_fresh()
bet.queue_status = bet.queue_status.move_to_process()

self.store_bets()

Expand Down
6 changes: 5 additions & 1 deletion packages/valory/skills/decision_maker_abci/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
# Copyright 2023-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -217,6 +217,9 @@ def __init__(self, *args: Any, skill_context: SkillContext, **kwargs: Any) -> No
# the key is the market id/question_id
self.bet_id_row_manager: Dict[str, List[int]] = {}

# mech call counter for benchmarking behaviour
self.benchmarking_mech_calls: int = 0

@property
def mock_question_id(self) -> Any:
"""Get the mock question id."""
Expand Down Expand Up @@ -529,6 +532,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self._ensure("results_filename", kwargs, str)
)
self.randomness: str = self._ensure("randomness", kwargs, str)
self.nr_mech_calls: int = self._ensure("nr_mech_calls", kwargs, int)
super().__init__(*args, **kwargs)


Expand Down
11 changes: 6 additions & 5 deletions packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ fingerprint:
__init__.py: bafybeih563ujnigeci2ldzh7hakbau6a222vsed7leg3b7lq32vcn3nm4a
behaviours/__init__.py: bafybeih6ddz2ocvm6x6ytvlbcz6oi4snb5ee5xh5h65nq4w2qf7fd7zfky
behaviours/base.py: bafybeibkwfsd2atjzejhsel5p4cptd2wg2shefyly5jbiywgbjvx6k2q4y
behaviours/bet_placement.py: bafybeidyucxomadfzr6eyfywlc4satl4vqb6qhdkyzdp76zkxbfjfyzai4
behaviours/bet_placement.py: bafybeibiezagww5dsbpptgvtzgch3yjrq3343gw5cyfpckegxkfzo67vru
behaviours/blacklisting.py: bafybeieuqoup2vrmrtvjfqnr5mzrvkegc7afb2oeujzq2itsbhcsham2se
behaviours/check_benchmarking.py: bafybeiao2lyj7apezkqrpgsyzb3dwvrdgsrgtprf6iuhsmlsufvxfl5bci
behaviours/claim_subscription.py: bafybeigbqkhc6mb73rbwaks32tfiqx6u2xza43uiy6rvbtrnqd6m4fru3e
behaviours/decision_receive.py: bafybeibsthk6fjydkengwzgpgz5v44xpta67nnlyxt6uugx2voitqgojpq
behaviours/decision_receive.py: bafybeiblt4of7gykqvql7ctchakbx27uxvesizbhczlvcqzr35f7zyjjci
behaviours/decision_request.py: bafybeia22omb7tvocyfe3z2ucn5au5mcas7dg37ha42u7znefzrewjpk7y
behaviours/handle_failed_tx.py: bafybeiashwlfp6ty3g6ukgmliaghwu6yiunbqpjmyrzheokw3pbcr2ckaq
behaviours/order_subscription.py: bafybeihwuhgykptokmeam5sacnfzedk5puvrxbjo7iypaqhsrqg5nk7psm
behaviours/randomness.py: bafybeiaoj3awyyg2onhpsdsn3dyczs23gr4smuzqcbw3e5ocljwxswjkce
behaviours/reedem.py: bafybeiajxsz34iy24muw4avq4vbevluhsabjcyqaadssnrs2zrfdapbnqq
behaviours/round_behaviour.py: bafybeih63hpia2bwwzu563hxs5yd3t5ycvxvkfnhvxbzghbyy3mw3xjl3i
behaviours/sampling.py: bafybeicvtxjv5rxlsdrmbtetqwzzau6is47guystvw245grd6s2qs5pxea
behaviours/sampling.py: bafybeiet37e4o4s5kdf4u4denls7iaqm6b2a2mqa5eu576waiwmuwozhmi
behaviours/storage_manager.py: bafybeic6wca37fkwonbsrwme55xnklfbqtheknroudayzfxdge4pxdbm7y
behaviours/tool_selection.py: bafybeienlxcgjs3ogyofli3d7q3p5rst3mcxxcnwqf7qolqjeefjtixeke
dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm
fsm_specification.yaml: bafybeifvu7n6sjmrerogkzsftjrw2l6w5ppuq3f43ouj2rwbomdr5glp2e
handlers.py: bafybeibf42562x3d5i66yf5p3vi6a2oolhwwxr32pjqtuxz5w4gmg3r4oa
io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq
io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa
models.py: bafybeihvmxk5nve54v3yz7uaobekdzg37675ooiqxb7ne5hmeegfhk6c6m
models.py: bafybeidnsn7xixmyync4vdd3whhptiyvfa2s457uy7sjrs22djsx7ddtvq
payloads.py: bafybeieygushjlrzwzpnhagjgpbs3goot3pnfheh6yawuwctrk3uoeesfm
policy.py: bafybeidofgwvk6sudz75tvuduskuphtn3amtib2irzw5hr3qcfn5pdwuc4
redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm
Expand Down Expand Up @@ -101,7 +101,7 @@ protocols:
- valory/http:1.0.0:bafybeifugzl63kfdmwrxwphrnrhj7bn6iruxieme3a4ntzejf6kmtuwmae
skills:
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/market_manager_abci:0.1.0:bafybeiayhzwxlpqsevyvaxn6dtnnu745az5vcz7dckmghnmjywxdtvoyly
- valory/market_manager_abci:0.1.0:bafybeidt6wx527mmmpadbkxjl57uugprmgtuskvkiutvtzo7op6lkarnea
- valory/transaction_settlement_abci:0.1.0:bafybeifmgmwdkx4esemxjacjwzqkqymkuklb5nehkwqkx7v335fllgswcq
- valory/mech_interact_abci:0.1.0:bafybeib4vn6m2yumwoclh5aatcdt5yxcjc5owxmxy5o7t3nfzormgwkr64
- valory/staking_abci:0.1.0:bafybeiaasclr4lf3u2layekmfwyasckxrslbs2g4me7kvozz5goswlznjq
Expand Down Expand Up @@ -330,6 +330,7 @@ models:
bet_amount_field: collateral_amount
results_filename: benchmarking_results.csv
randomness: benchmarking_randomness
nr_mech_calls: 60
class_name: BenchmarkingMode
acc_info_fields:
args:
Expand Down
19 changes: 9 additions & 10 deletions packages/valory/skills/market_manager_abci/bets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2023-2024 Valory AG
# Copyright 2023-2025 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,6 +44,7 @@ class QueueStatus(Enum):
TO_PROCESS = 1 # Bets that are ready to be processed
PROCESSED = 2 # Bets that have been processed
REPROCESSED = 3 # Bets that have been reprocessed
BENCHMARKING_DONE = 4

def is_fresh(self) -> bool:
"""Check if the bet is fresh."""
Expand All @@ -61,7 +62,7 @@ def move_to_process(self) -> "QueueStatus":

def move_to_fresh(self) -> "QueueStatus":
"""Move the bet to the fresh status."""
if self != QueueStatus.EXPIRED:
if self not in [QueueStatus.EXPIRED, QueueStatus.BENCHMARKING_DONE]:
return QueueStatus.FRESH
return self

Expand Down Expand Up @@ -311,14 +312,12 @@ def hook(data: Dict[str, Any]) -> Union[Bet, PredictionResponse, Dict[str, Bet]]
if bet_annotations == data_attributes:
data["queue_status"] = QueueStatus(data["queue_status"])
return Bet(**data)
else:
# fetch missing attributes from the data
missing_attributes = set(bet_annotations) - set(data_attributes)
new_attributes = {"queue_status", "invested_amount"}
if missing_attributes == new_attributes:
data["queue_status"] = QueueStatus(0)
data["invested_amount"] = 0
return Bet(**data)
elif "id" in data_attributes:
common_attributes = set(bet_annotations) & set(data_attributes)
data = {key: data[key] for key in common_attributes}
if "queue_status" in data:
data["queue_status"] = QueueStatus(data["queue_status"])
return Bet(**data)

return data

Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/market_manager_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fingerprint:
README.md: bafybeie6miwn67uin3bphukmf7qgiifh4xtm42i5v3nuyqxzxtehxsqvcq
__init__.py: bafybeigrtedqzlq5mtql2ssjsdriw76ml3666m4e2c3fay6vmyzofl6v6e
behaviours.py: bafybeicfoszavcyrzahe6qaydlaf27mpbwui7a6wgdbstydbzxmdisxhju
bets.py: bafybeibx3x5nasuj6loneeat2lb7fr7kgsmnz7on7f4gxfbpzerzdvawou
bets.py: bafybeic6vh2igtfkvzdr3pa44lbbd6twklzky7px7td2c2boubunxogtfu
dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm
fsm_specification.yaml: bafybeic5cvwfbiu5pywyp3h5s2elvu7jqdrcwayay7o3v3ow47vu2jw53q
graph_tooling/__init__.py: bafybeigzo7nhbzafyq3fuhrlewksjvmzttiuk4vonrggtjtph4rw4ncpk4
Expand Down
Loading
Loading