diff --git a/packages/packages.json b/packages/packages.json index e6db0128d..7e071f5af 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { "skill/valory/market_manager_abci/0.1.0": "bafybeibrjre5yka3sbvb6lsefgc5yutovb6h4ffzrpecplfkjwtl5i36te", - "skill/valory/decision_maker_abci/0.1.0": "bafybeiguvfiaytb7i3p5sluubvehvzcu4wdzch4avdyxhj6332mkohv674", - "skill/valory/trader_abci/0.1.0": "bafybeieiyu5q5tppj5dryl2iwgelzct5obhxhbkdxq7qsdo7kedxipwz2y", + "skill/valory/decision_maker_abci/0.1.0": "bafybeiejunyhbfzk3tqn22xmyvpyn75xyjsbeg7grjrywhecak3phbwwem", + "skill/valory/trader_abci/0.1.0": "bafybeid3uohgff4mv6qdaed477c2bvrlo72nq7lzfyfkfki2snyhdgntxu", "contract/valory/market_maker/0.1.0": "bafybeif4mm2s3gxtvp227yypkcnna5ftec7vajcftvtbdmqddh7nprah5m", - "agent/valory/trader/0.1.0": "bafybeiemjwe2bzp7b5ktoni3srkuax3y7d5fjopyxcgawebttbmpljt2we", - "service/valory/trader/0.1.0": "bafybeibcegbsdfnkka43lmk7b4ttgy4ao655viecz3gesgt3242u2cda5m", + "agent/valory/trader/0.1.0": "bafybeig7ccohw2wommcnhunepnjageyssxx335pgvvpn4g6bnoyfhhl36m", + "service/valory/trader/0.1.0": "bafybeidd3vf3jnidjkce6zfzoabrfmh5dc2qnnyb2arexqedxis3olmnqu", "contract/valory/erc20/0.1.0": "bafybeieqj7dea4tcv6z2yqkgtmhd23vbiycsr5trhwxdvlbwulpl6vhmam", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeig2bhnaog7t7dmsbbkaozjj6ifmhmjgsd76p6rndx2kvv2bknk2qm", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibixthabcfuz3ttgjiy2sfdurrefb2gzkaqxcznmngxtr37kbqmvu", "contract/valory/mech/0.1.0": "bafybeihvc6btuk3nvernzcx4qpezvuhiw2wwnagqj5nkeljvszghv7mq64", "contract/valory/realitio/0.1.0": "bafybeiamgkwwqhray4fs2hlipwxkq7mosmi7ev7jut4vneetaaycc4ruji", "contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4", diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index 31134f956..8da0197f4 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -43,10 +43,10 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeicpxn2khtaesuf4cq6ypwdmdmonlqroj2q2i6cxvpizc2y4cw66pe - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig2bhnaog7t7dmsbbkaozjj6ifmhmjgsd76p6rndx2kvv2bknk2qm +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibixthabcfuz3ttgjiy2sfdurrefb2gzkaqxcznmngxtr37kbqmvu - valory/market_manager_abci:0.1.0:bafybeibrjre5yka3sbvb6lsefgc5yutovb6h4ffzrpecplfkjwtl5i36te -- valory/decision_maker_abci:0.1.0:bafybeiguvfiaytb7i3p5sluubvehvzcu4wdzch4avdyxhj6332mkohv674 -- valory/trader_abci:0.1.0:bafybeieiyu5q5tppj5dryl2iwgelzct5obhxhbkdxq7qsdo7kedxipwz2y +- valory/decision_maker_abci:0.1.0:bafybeiejunyhbfzk3tqn22xmyvpyn75xyjsbeg7grjrywhecak3phbwwem +- valory/trader_abci:0.1.0:bafybeid3uohgff4mv6qdaed477c2bvrlo72nq7lzfyfkfki2snyhdgntxu - valory/staking_abci:0.1.0:bafybeichs6yhjv24mgccqt6hlcqakpfcxit6gvowziz7pb2w6hxfc5wyem default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 2b47ee07b..066a24736 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:bafybeiemjwe2bzp7b5ktoni3srkuax3y7d5fjopyxcgawebttbmpljt2we +agent: valory/trader:0.1.0:bafybeig7ccohw2wommcnhunepnjageyssxx335pgvvpn4g6bnoyfhhl36m number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/behaviours/decision_request.py b/packages/valory/skills/decision_maker_abci/behaviours/decision_request.py index 4c3b367da..fce0e127d 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/decision_request.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/decision_request.py @@ -116,8 +116,9 @@ def n_slots_supported(self) -> bool: @property def xdai_deficit(self) -> int: - """Get the amount of missing xDAI for sending the request.""" - return self.price - self.wallet_balance + """Get the amount of missing xDAI for sending the request plus betting the maximum amount.""" + max_bet_amount = 0 if self.params.using_kelly else self.params.max_bet_amount + return (self.price + max_bet_amount) - self.wallet_balance @property def multisend_optional(self) -> bool: @@ -207,10 +208,14 @@ def _check_unwrap(self) -> WaitableConditionType: yield from self.wait_for_condition_with_sleep(self._build_unwrap_tx) return True - self.context.logger.warning( - "The balance is not enough to pay for the mech's price. " - f"Please refill the safe with at least {self.wei_to_native(missing)} xDAI or wxDAI." - ) + balance_info = "The balance is not enough to pay for the mech's price" + refill_info = f". Please refill the safe with at least {self.wei_to_native(missing)} xDAI or wxDAI." + if not self.params.using_kelly: + balance_info += " and place the maximum bet amount" + refill_info += ( + " Alternatively, you could decrease the configured bet amounts." + ) + self.context.logger.warning(balance_info + refill_info) self.sleep(self.params.sleep_time) return False diff --git a/packages/valory/skills/decision_maker_abci/behaviours/sampling.py b/packages/valory/skills/decision_maker_abci/behaviours/sampling.py index a56cdf3a8..a74cf81ab 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/sampling.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/sampling.py @@ -47,7 +47,7 @@ def available_bets(self) -> Iterator[Bet]: bets = self.synchronized_data.bets # Note: the openingTimestamp is misleading as it is the closing timestamp of the bet - if self.params.trading_strategy == "kelly_criterion": + if self.params.using_kelly: # get only bets that close in the next 48 hours bets = [ bet diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index afb41b77b..3f032ba08 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -226,6 +226,16 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.irrelevant_tools: set = set(self._ensure("irrelevant_tools", kwargs, list)) super().__init__(*args, **kwargs) + @property + def using_kelly(self) -> bool: + """Get the max bet amount if the `bet_amount_per_conf_threshold` strategy is used.""" + return self.trading_strategy == "kelly_criterion" + + @property + def max_bet_amount(self) -> int: + """Get the max bet amount for the `bet_amount_per_conf_threshold` strategy.""" + return max(self.bet_amount_per_threshold.values()) + @property def ipfs_address(self) -> str: """Get the IPFS address.""" diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index eb1202220..b29874dda 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -16,16 +16,16 @@ fingerprint: behaviours/bet_placement.py: bafybeigtz4uimsqjjwq4r5p3a5v6niqdtqezbuf2ghy6o7syhsh4k5gjfa behaviours/blacklisting.py: bafybeicl6b4hcmqmekta2mcuhkkydnzk7jmic6k44e6ns3u2ibad3awzvu behaviours/decision_receive.py: bafybeifacce2ke7oltnwnpdjdqfd74eaaw5wxnjfzk6c5tqdsxsmbzjj3m - behaviours/decision_request.py: bafybeibrk6jxalkgspinmjboqr3o6d6hl6mxtlkif74a5p32vp2zzhhzua + behaviours/decision_request.py: bafybeievr7vae43e7jr4eqqhwe3emvgiih7ysa66jcb5g2oz5lbxua232q behaviours/handle_failed_tx.py: bafybeidxpc6u575ymct5tdwutvzov6zqfdoio5irgldn3fw7q3lg36mmxm behaviours/reedem.py: bafybeiepr4sellesn37csr7tmd4yhdsnn6y2jmy6kaculty6pffjc6tawe behaviours/round_behaviour.py: bafybeig4tdktyu6hapoqymnxh2bgpds547st6a44heue657wkctwe4gjvm - behaviours/sampling.py: bafybeieu4obvwhsquvgmdi7moo4eajdh376oqlzb4zu3wsznovg2o5x2de + behaviours/sampling.py: bafybeifzhm4sspdvt227ksl5hjn26offgqpwempgbcwbr6dq7gyi2a46sm behaviours/tool_selection.py: bafybeigfr2frkljrxyfxs5p3j42equzehgaqtkyuxk6eiujyudr6ajqakm dialogues.py: bafybeigpwuzku3we7axmxeamg7vn656maww6emuztau5pg3ebsoquyfdqm fsm_specification.yaml: bafybeifnob3ceim2mj7lqagtnpwqjqqxs5eg3oiwc73gwm6x5i2dvvlcya handlers.py: bafybeihj33szgrcxnpd73s4nvluyxwwsvhjum2cuq3ilhhe6vfola3k7vy - models.py: bafybeib5qqd7cty2onkkocwbeueosra4xkgv4z7u2xnrhrkc63xb6jjs7q + models.py: bafybeiauwt4y7m3c675zs2uavz2cn45agkx4fxpgpvry4npxsstvxppsy4 payloads.py: bafybeifhq6stu4vp2ef4qvihxgpos3yc2zcuaja2safwt7efdidoejgvqa policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeibddfxwp3577c3dl2utaowwltquu5fg6crezpumoebw563wxpbfrm diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 252cd5986..724773400 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -25,8 +25,8 @@ skills: - valory/transaction_settlement_abci:0.1.0:bafybeia6cdxdlqrcwk2maw25fo7dafzd2p3rs7syropvufophk2pitzbwy - valory/termination_abci:0.1.0:bafybeieqm46zuccaagnko3qlw6p3nvoohdrfgvpmw467r5lyil2dqrzjsy - valory/market_manager_abci:0.1.0:bafybeibrjre5yka3sbvb6lsefgc5yutovb6h4ffzrpecplfkjwtl5i36te -- valory/decision_maker_abci:0.1.0:bafybeiguvfiaytb7i3p5sluubvehvzcu4wdzch4avdyxhj6332mkohv674 -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeig2bhnaog7t7dmsbbkaozjj6ifmhmjgsd76p6rndx2kvv2bknk2qm +- valory/decision_maker_abci:0.1.0:bafybeiejunyhbfzk3tqn22xmyvpyn75xyjsbeg7grjrywhecak3phbwwem +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibixthabcfuz3ttgjiy2sfdurrefb2gzkaqxcznmngxtr37kbqmvu - valory/staking_abci:0.1.0:bafybeichs6yhjv24mgccqt6hlcqakpfcxit6gvowziz7pb2w6hxfc5wyem 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 ab9a4986c..a0f961459 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -20,7 +20,7 @@ contracts: [] protocols: [] skills: - valory/abstract_round_abci:0.1.0:bafybeid7neqpxxe4ualp23gxgrtpf6r5u3myr2mmc4uvwameyqshfdoydq -- valory/decision_maker_abci:0.1.0:bafybeiguvfiaytb7i3p5sluubvehvzcu4wdzch4avdyxhj6332mkohv674 +- valory/decision_maker_abci:0.1.0:bafybeiejunyhbfzk3tqn22xmyvpyn75xyjsbeg7grjrywhecak3phbwwem - valory/staking_abci:0.1.0:bafybeichs6yhjv24mgccqt6hlcqakpfcxit6gvowziz7pb2w6hxfc5wyem behaviours: main: