Skip to content

Commit

Permalink
Merge pull request #306 from valory-xyz/v0.18.0
Browse files Browse the repository at this point in the history
Release `v0.18.0`
  • Loading branch information
Adamantios authored Jul 29, 2024
2 parents db40345 + 98a767f commit e4b794b
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 34 deletions.
14 changes: 7 additions & 7 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"custom/valory/mike_strat/0.1.0": "bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m",
"custom/jhehemann/kelly_criterion/0.1.0": "bafybeif55cu7cf6znyma7kxus4wxa2doarhau2xmndo57iegshxorivwmq",
"custom/w1kke/always_blue/0.1.0": "bafybeieshu32h3es2fslduuhr7nimuvh2vuibyeqdunzrcggaeohekg3jm",
"custom/valory/kelly_criterion_no_conf/0.1.0": "bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",
"custom/valory/kelly_criterion_no_conf/0.1.0": "bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",
"contract/valory/market_maker/0.1.0": "bafybeiba25nt26ntjzkkpfyl2ngbjxrfd44ckg3znfhqm552725vb3gaka",
"contract/valory/realitio/0.1.0": "bafybeignaxfk7fjlfa4lioflwsfru2z5xln5cyvyew3if5oas2sgm5wuii",
"contract/valory/realitio_proxy/0.1.0": "bafybeidx37xzjjmapwacedgzhum6grfzhp5vhouz4zu3pvpgdy5pgb2fr4",
Expand All @@ -16,14 +16,14 @@
"contract/valory/staking_token/0.1.0": "bafybeig4fl35dn7d5gnprux2nwsqbirm7zkiujz3xvrwcjuktz6hkq4as4",
"contract/valory/relayer/0.1.0": "bafybeihzgjyvhtorugjw3yldznqsbwo3aqpxowm7k2nrvj6qtwpsc7jl7u",
"skill/valory/market_manager_abci/0.1.0": "bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e",
"skill/valory/decision_maker_abci/0.1.0": "bafybeigykiciajiq5za7szupck5jbj6z6dvnmoufdam7eyigpn4mr6c6bq",
"skill/valory/trader_abci/0.1.0": "bafybeid23zogdrlauifqprlogztejgb2yl3ohcvqcat7nab2hgvez4bzru",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidcw2bzonvlgtyuv76zkutjs7qv5j4wgvi6azthqpyefds6i5cvdm",
"skill/valory/decision_maker_abci/0.1.0": "bafybeieaenzaucsz7234gynswn7f2ufsvhkhbniuc4mhh3kvu7atvdjqwu",
"skill/valory/trader_abci/0.1.0": "bafybeidqh5nmjg6jk5hwqzf3abvjd4jiabs6eroisw5nh6d557isorxely",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiatr5y2qhqkqc7xtllwagk66wfnmbvdjmokb6ptlrhczzwwn76fce",
"skill/valory/staking_abci/0.1.0": "bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeiepylk35n3faurvp7dskjkdovehftzfjrjxfkpekzuaovt5gojxne",
"agent/valory/trader/0.1.0": "bafybeigw6e7b5riiinbxa263q2k7qrk3zbejuabngdm2g4w2uu42qyyzsy",
"service/valory/trader/0.1.0": "bafybeigjc2g6dk26cfkjscg2qovlhjrqckw45tdfiikgqdg3xdxsllf2wm",
"service/valory/trader_pearl/0.1.0": "bafybeia2pb5efg3hxwpq7aa332puxyrpyvjkpnktsnjjaqw7ytutqifkvq"
"agent/valory/trader/0.1.0": "bafybeifinxnuxu4ye2catrgrma7uyqm3f2hlurs4xsch27xftfo6im5ihm",
"service/valory/trader/0.1.0": "bafybeidgliu5ylcpznirtn6vfs3g4d74utzfciuo4yqgcuj3ux6iwz5v2y",
"service/valory/trader_pearl/0.1.0": "bafybeihtghhxevo7yp46znaexcpoytqkxgi2tc56wusak525vdwwfrjfla"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
12 changes: 6 additions & 6 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidcw2bzonvlgtyuv76zkutjs7qv5j4wgvi6azthqpyefds6i5cvdm
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiatr5y2qhqkqc7xtllwagk66wfnmbvdjmokb6ptlrhczzwwn76fce
- valory/market_manager_abci:0.1.0:bafybeiai6djelf6d4dkxgkv46l24q2gz7736b3jdhbxslvcydpvnvrse6e
- valory/decision_maker_abci:0.1.0:bafybeigykiciajiq5za7szupck5jbj6z6dvnmoufdam7eyigpn4mr6c6bq
- valory/trader_abci:0.1.0:bafybeid23zogdrlauifqprlogztejgb2yl3ohcvqcat7nab2hgvez4bzru
- valory/decision_maker_abci:0.1.0:bafybeieaenzaucsz7234gynswn7f2ufsvhkhbniuc4mhh3kvu7atvdjqwu
- valory/trader_abci:0.1.0:bafybeidqh5nmjg6jk5hwqzf3abvjd4jiabs6eroisw5nh6d557isorxely
- valory/staking_abci:0.1.0:bafybeiduborfqevheegy3plk7bzhkl4fukwixvlb57tenijdepintubbdi
- valory/check_stop_trading_abci:0.1.0:bafybeiepylk35n3faurvp7dskjkdovehftzfjrjxfkpekzuaovt5gojxne
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
customs:
- valory/mike_strat:0.1.0:bafybeihjiol7f4ch4piwfikurdtfwzsh6qydkbsztpbwbwb2yrqdqf726m
- valory/bet_amount_per_threshold:0.1.0:bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24
- valory/kelly_criterion_no_conf:0.1.0:bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple
- valory/kelly_criterion_no_conf:0.1.0:bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae
- w1kke/always_blue:0.1.0:bafybeieshu32h3es2fslduuhr7nimuvh2vuibyeqdunzrcggaeohekg3jm
- jhehemann/kelly_criterion:0.1.0:bafybeif55cu7cf6znyma7kxus4wxa2doarhau2xmndo57iegshxorivwmq
default_ledger: ethereum
Expand Down Expand Up @@ -232,8 +232,8 @@ models:
refill_check_interval: ${int:10}
tool_punishment_multiplier: ${int:1}
contract_timeout: ${float:300.0}
file_hash_to_strategies_json: ${list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
file_hash_to_strategies_json: ${list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${list:[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
service_endpoint: ${str:https://trader.staging.autonolas.tech/}
rpc_sleep_time: ${int:10}
mech_interaction_sleep_time: ${int:10}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
aea_version: '>=1.0.0, <2.0.0'
fingerprint:
__init__.py: bafybeidog73nvs6bfta5pmaxufwly6pc52knbnxqlwcwka4cpnyneeykqi
kelly_criterion_no_conf.py: bafybeiffkggwm23e7rfek5skvxd455sjxosjstkabrteyld7bgxuyz6bo4
kelly_criterion_no_conf.py: bafybeifrdnpes4jbhnkesuuk5pktyz2udlx4d5yr73ebgqpzpiqywixhom
fingerprint_ignore_patterns: []
entry_point: kelly_criterion_no_conf.py
callable: run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

"""This module contains the kelly criterion strategy without confidence factor in the formula."""

from typing import Dict, Any, List, Union
from typing import Dict, Any, List, Union, Optional

REQUIRED_FIELDS = frozenset(
{
Expand All @@ -31,6 +31,7 @@
"selected_type_tokens_in_pool",
"other_tokens_in_pool",
"bet_fee",
"weighted_accuracy",
"floor_balance",
}
)
Expand All @@ -53,6 +54,30 @@ def remove_irrelevant_fields(kwargs: Dict[str, Any]) -> Dict[str, Any]:
return {key: value for key, value in kwargs.items() if key in ALL_FIELDS}


def get_adjusted_kelly_amount(
kelly_bet_amount: float,
weighted_accuracy: Optional[float],
static_kelly_fraction: float,
error: list,
):
"""This function adjusts the kelly bet amount based on the weighted accuracy metric
of the selected tool to make the prediction. Default use-case: it uses the static kelly fraction
"""
if weighted_accuracy is None:
error.append(
f"No weighted accuracy information for this tool. Using static fraction."
)
return int(kelly_bet_amount * static_kelly_fraction)
# weighted_accuracy must be always between [0, 1]
if not (0 <= weighted_accuracy <= 1):
error.append(
f"Wrong value for the weighted accuracy {weighted_accuracy}. Accepted range [0, 1]. Using static fraction"
)
return int(kelly_bet_amount * static_kelly_fraction)
dynamic_kelly_fraction = static_kelly_fraction + weighted_accuracy
return int(kelly_bet_amount * dynamic_kelly_fraction)


def calculate_kelly_bet_amount_no_conf(
x: int, y: int, p: float, b: int, f: float
) -> int:
Expand Down Expand Up @@ -104,6 +129,7 @@ def get_bet_amount_kelly( # pylint: disable=too-many-arguments
selected_type_tokens_in_pool: int,
other_tokens_in_pool: int,
bet_fee: int,
weighted_accuracy: float,
floor_balance: int,
max_bet: int = DEFAULT_MAX_BET,
) -> Dict[str, Union[int, List[str]]]:
Expand Down Expand Up @@ -139,7 +165,12 @@ def get_bet_amount_kelly( # pylint: disable=too-many-arguments

info.append(f"Kelly bet amount: {wei_to_native(kelly_bet_amount)} xDAI")
info.append(f"Bet kelly fraction: {bet_kelly_fraction}")
adj_kelly_bet_amount = int(kelly_bet_amount * bet_kelly_fraction)
info.append(
f"Applying dynamic kelly fraction to all bets. Weighted accuracy of the tool={weighted_accuracy}"
)
adj_kelly_bet_amount = get_adjusted_kelly_amount(
kelly_bet_amount, weighted_accuracy, bet_kelly_fraction, error
)
info.append(
f"Adjusted Kelly bet amount: {wei_to_native(adj_kelly_bet_amount)} xDAI"
)
Expand Down
18 changes: 9 additions & 9 deletions 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:bafybeigw6e7b5riiinbxa263q2k7qrk3zbejuabngdm2g4w2uu42qyyzsy
agent: valory/trader:0.1.0:bafybeifinxnuxu4ye2catrgrma7uyqm3f2hlurs4xsch27xftfo6im5ihm
number_of_agents: 4
deployment:
agent:
Expand Down Expand Up @@ -127,8 +127,8 @@ type: skill
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
contract_timeout: ${CONTRACT_TIMEOUT:float:300.0}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true}
use_nevermined: ${USE_NEVERMINED:bool:false}
mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],
Expand Down Expand Up @@ -348,8 +348,8 @@ type: skill
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
contract_timeout: ${CONTRACT_TIMEOUT:float:300.0}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true}
use_nevermined: ${USE_NEVERMINED:bool:false}
mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],
Expand Down Expand Up @@ -463,8 +463,8 @@ type: skill
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
contract_timeout: ${CONTRACT_TIMEOUT:float:300.0}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true}
use_nevermined: ${USE_NEVERMINED:bool:false}
mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],
Expand Down Expand Up @@ -578,8 +578,8 @@ type: skill
tool_punishment_multiplier: ${TOOL_PUNISHMENT_MULTIPLIER:int:1}
redeem_round_timeout: ${REDEEM_ROUND_TIMEOUT:float:3600.0}
contract_timeout: ${CONTRACT_TIMEOUT:float:300.0}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeihnweebd6lxqtiat2mgspp5tpal4e2hntwdxvptkmbunpdxq2fple",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",0.5],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
file_hash_to_strategies_json: ${FILE_HASH_TO_STRATEGIES_JSON:list:[["bafybeihufqu2ra7vud4h6g2nwahx7mvdido7ff6prwnib2tdlc4np7dw24",["bet_amount_per_threshold"]],["bafybeibxfp27rzrfnp7sxq62vwv32pdvrijxi7vzg7ihukkaka3bwzrgae",["kelly_criterion_no_conf"]]]}
strategies_kwargs: ${STRATEGIES_KWARGS:list:[["bet_kelly_fraction",1.0],["floor_balance",500000000000000000],["bet_amount_per_threshold",{"0.0":0,"0.1":0,"0.2":0,"0.3":0,"0.4":0,"0.5":0,"0.6":60000000000000000,"0.7":90000000000000000,"0.8":100000000000000000,"0.9":1000000000000000000,"1.0":10000000000000000000}]]}
use_subgraph_for_redeeming: ${USE_SUBGRAPH_FOR_REDEEMING:bool:true}
use_nevermined: ${USE_NEVERMINED:bool:false}
mech_to_subscription_params: ${SUBSCRIPTION_PARAMS:list:[["base_url", "https://marketplace-api.gnosis.nevermined.app/api/v1/metadata/assets/ddo"],
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:bafybeigw6e7b5riiinbxa263q2k7qrk3zbejuabngdm2g4w2uu42qyyzsy
agent: valory/trader:0.1.0:bafybeifinxnuxu4ye2catrgrma7uyqm3f2hlurs4xsch27xftfo6im5ihm
number_of_agents: 1
deployment:
agent:
Expand Down
2 changes: 2 additions & 0 deletions packages/valory/skills/decision_maker_abci/behaviours/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def get_bet_amount(
selected_type_tokens_in_pool: int,
other_tokens_in_pool: int,
bet_fee: int,
weighted_accuracy: float,
) -> Generator[None, None, int]:
"""Get the bet amount given a specified trading strategy."""
yield from self.download_strategies()
Expand All @@ -423,6 +424,7 @@ def get_bet_amount(
"selected_type_tokens_in_pool": selected_type_tokens_in_pool,
"other_tokens_in_pool": other_tokens_in_pool,
"bet_fee": bet_fee,
"weighted_accuracy": weighted_accuracy,
}
)
results = self.execute_strategy(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ def _is_profitable(
selected_type_tokens_in_pool,
other_tokens_in_pool,
bet.fee,
self.synchronized_data.weighted_accuracy,
)
bet_threshold = self.params.bet_threshold
bet_amount = max(bet_amount, bet_threshold)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,15 @@ def _update_accuracy_store(self, local_tools: List[str]) -> None:
def _set_policy(self) -> Generator:
"""Set the E Greedy Policy."""
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()
local_tools = self._try_recover_mech_tools()
if local_tools is None:
local_tools = self.mech_tools
else:
self.context.logger.debug(
"Reading policy information from synchronized data"
)
self._policy = self.synchronized_data.policy
local_tools = self.synchronized_data.available_mech_tools

Expand Down
Loading

0 comments on commit e4b794b

Please sign in to comment.