From aa71fd30f410492e1058e9ff2f38bd148c1a7bce Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 4 Jan 2024 10:29:46 +0100 Subject: [PATCH 01/20] chore: add polymarket params --- packages/packages.json | 12 +++++------ packages/valory/agents/trader/aea-config.yaml | 9 +++++---- packages/valory/services/trader/service.yaml | 3 ++- .../skills/decision_maker_abci/skill.yaml | 2 +- .../skills/market_manager_abci/behaviours.py | 1 + .../graph_tooling/requests.py | 12 +++++++++++ .../skills/market_manager_abci/models.py | 3 +++ .../skills/market_manager_abci/skill.yaml | 20 ++++++++++++++++--- packages/valory/skills/trader_abci/skill.yaml | 7 ++++--- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 10 files changed, 52 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 56549858c..e9af81443 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq", - "skill/valory/decision_maker_abci/0.1.0": "bafybeierl6mzrv3t5syjhexsjlpp5yl4sudsefq7vuhqecjl34oimw2r3i", - "skill/valory/trader_abci/0.1.0": "bafybeiev2fof2q75jgvezoyxnba4p5rhpfjqm43ochgrvht4c7nhtrfrfm", + "skill/valory/market_manager_abci/0.1.0": "bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y", + "skill/valory/decision_maker_abci/0.1.0": "bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq", + "skill/valory/trader_abci/0.1.0": "bafybeia5innpj6zaa2ed3krl67k5hdvch73m3u7brvupfy3f3yrfogy4lm", "contract/valory/market_maker/0.1.0": "bafybeiain372i5t6eteem36vzhwh6ppka6hc4oyrxjtyzuar6rd6bjocem", - "agent/valory/trader/0.1.0": "bafybeibsjizxyskhddlgjtx6qs7cqyn5bm4y3ql57g3j2b6xn52aijxyxi", - "service/valory/trader/0.1.0": "bafybeigapd7ohrdt5ipn63hduuhhqz62vtfir6l2tltpbv7jojpe776k2e", + "agent/valory/trader/0.1.0": "bafybeidjhdxb75amxwvkcrk7hjjyvvparzso2ljkiu5s7ava3onzxjtdre", + "service/valory/trader/0.1.0": "bafybeibgkrlkpewpjiwbfuhhllu5ua4srn6nptesjzbwfdmikfbjs4urwq", "contract/valory/erc20/0.1.0": "bafybeiad6qbyhr3sgvclqne7tvyvqt32pcj5aq47hhkd2vmawaflhy5vna", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeidqlklypdnspvfu7rbaynwvgrwfwqcysddsyhb3gwj65nymqqr33q", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi", "contract/valory/mech/0.1.0": "bafybeiauxqogu726oeethvzux6r77zgn7sw5j2l4uigqb47zlqawblkv6e", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "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 2025dd19c..7ae37c1ff 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:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidqlklypdnspvfu7rbaynwvgrwfwqcysddsyhb3gwj65nymqqr33q -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq -- valory/decision_maker_abci:0.1.0:bafybeierl6mzrv3t5syjhexsjlpp5yl4sudsefq7vuhqecjl34oimw2r3i -- valory/trader_abci:0.1.0:bafybeiev2fof2q75jgvezoyxnba4p5rhpfjqm43ochgrvht4c7nhtrfrfm +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi +- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y +- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq +- valory/trader_abci:0.1.0:bafybeia5innpj6zaa2ed3krl67k5hdvch73m3u7brvupfy3f3yrfogy4lm - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy default_ledger: ethereum required_ledgers: @@ -159,6 +159,7 @@ models: on_chain_service_id: ${int:null} creator_per_subgraph: omen_subgraph: ${list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} + polymarket_subgraph: ${list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${int:2} opening_margin: ${int:300} languages: ${list:["en_US"]} diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 92c92034f..98d912b93 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:bafybeibsjizxyskhddlgjtx6qs7cqyn5bm4y3ql57g3j2b6xn52aijxyxi +agent: valory/trader:0.1.0:bafybeidjhdxb75amxwvkcrk7hjjyvvparzso2ljkiu5s7ava3onzxjtdre number_of_agents: 4 deployment: {} --- @@ -72,6 +72,7 @@ type: skill history_check_timeout: ${HISTORY_CHECK_TIMEOUT:int:1205} creator_per_subgraph: &id003 omen_subgraph: ${OMEN_CREATORS:list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} + polymarket_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${SLOT_COUNT:int:2} opening_margin: ${OPENING_MARGIN:int:300} languages: ${LANGUAGES:list:["en_US"]} diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 1f0398658..23dbd2cdc 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -65,7 +65,7 @@ protocols: - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq +- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: diff --git a/packages/valory/skills/market_manager_abci/behaviours.py b/packages/valory/skills/market_manager_abci/behaviours.py index 964a435ee..03d130587 100644 --- a/packages/valory/skills/market_manager_abci/behaviours.py +++ b/packages/valory/skills/market_manager_abci/behaviours.py @@ -95,6 +95,7 @@ def _update_bets( self.bets = [] self.context.logger.info(f"Updated bets: {self.bets}") + exit(0) def async_act(self) -> Generator: """Do the action.""" diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index 7dff47042..de2deeafd 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -169,6 +169,18 @@ def _handle_response( return res def _fetch_bets(self) -> Generator[None, None, Optional[list]]: + """Fetch questions from the current subgraph, for the current creators.""" + print(self.current_subgraph.get_spec()) + if self.current_subgraph == "omen_subgraph": + return self._fetch_bets_omen() + elif self.current_subgraph == "polymarket_subgraph": + return None + + return None + + + + def _fetch_bets_omen(self) -> Generator[None, None, Optional[list]]: """Fetch questions from the current subgraph, for the current creators.""" self._fetch_status = FetchStatus.IN_PROGRESS diff --git a/packages/valory/skills/market_manager_abci/models.py b/packages/valory/skills/market_manager_abci/models.py index 8419734c4..21d4feb0b 100644 --- a/packages/valory/skills/market_manager_abci/models.py +++ b/packages/valory/skills/market_manager_abci/models.py @@ -48,6 +48,9 @@ class OmenSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" +class PolymarketSubgraph(ApiSpecs): + """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" + class NetworkSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the network's subgraph specifications.""" diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index a9fd360c0..6634c0ea8 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeie6miwn67uin3bphukmf7qgiifh4xtm42i5v3nuyqxzxtehxsqvcq __init__.py: bafybeigrtedqzlq5mtql2ssjsdriw76ml3666m4e2c3fay6vmyzofl6v6e - behaviours.py: bafybeigy224z5niaiafpkaj4jfatw3loywn7onn2obr33tld6lj3dkk33q + behaviours.py: bafybeig2yejepycsajbiq4spopsdlizfxfngwwae3xxddqp2r5c5zpgkwe bets.py: bafybeid5jw3o57bivq32ojphjmu3xoulf6y6r2pnzuhyp7u6nz3pojpbuu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeic5cvwfbiu5pywyp3h5s2elvu7jqdrcwayay7o3v3ow47vu2jw53q @@ -17,12 +17,13 @@ fingerprint: graph_tooling/queries/conditional_tokens.py: bafybeic6ohkdp4rvkcfglieksv6gbzm4qocpgdjaz4sroutl37sxijthji graph_tooling/queries/network.py: bafybeigeq72ys2nrjqspj2uacaudrgljrne5a3o5jvzsktldxdq6m2xmeu graph_tooling/queries/omen.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu + graph_tooling/queries/polymarket.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeieki6p6d77hi3ewd2rd4kk43v5y7buqozjnhysxopbzo64n3zy3kq + graph_tooling/requests.py: bafybeibolslldpvfks27wsg2voe45jjzpv3fdzgp5bjau3hix7c5lhmpty graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu - models.py: bafybeifmb4cojxesv2lcw6j3pm3yqjpsiuwyxpuexjbz656fpapdqcj2ba + models.py: bafybeieg7hfldv7lumasttqojiptbpxvrerpoay3e43f6fqenu4h3u7xmy payloads.py: bafybeiamavgddfbzofpsjthmw6j7g2dyxm7fb6hvdb47kweyrx4w2ihcfi rounds.py: bafybeihsphyqat2sn46nukisxpvx5g2yfal4iyobhnoccbeavfz7xnhhri fingerprint_ignore_patterns: [] @@ -135,6 +136,7 @@ models: serious_slash_unit_amount: 8000000000000000 creator_per_subgraph: omen_subgraph: [] + polymarket_subgraph: [] slot_count: 2 opening_margin: 300 languages: @@ -167,6 +169,18 @@ models: retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: OmenSubgraph + polymarket_subgraph: + args: + api_id: omen + headers: + Content-Type: application/json + method: POST + parameters: {} + response_key: data:fixedProductMarketMakers + response_type: list + retries: 5 + url: https://api.thegraph.com/subgraphs/name/polymarket/matic-markets + class_name: PolymarketSubgraph requests: args: {} class_name: Requests diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index ddbe08afc..45d86be49 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeietn6vjbxbqvkf4rxodm3feh4ayaliltlxofnb5tiie5yo3cbspiq -- valory/decision_maker_abci:0.1.0:bafybeierl6mzrv3t5syjhexsjlpp5yl4sudsefq7vuhqecjl34oimw2r3i -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeidqlklypdnspvfu7rbaynwvgrwfwqcysddsyhb3gwj65nymqqr33q +- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y +- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: @@ -138,6 +138,7 @@ models: validate_timeout: 1205 creator_per_subgraph: omen_subgraph: [] + polymarket_subgraph: [] slot_count: 2 opening_margin: 300 languages: diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index c71315e32..29b208020 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeierl6mzrv3t5syjhexsjlpp5yl4sudsefq7vuhqecjl34oimw2r3i +- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: From 9cc04d3251546e45ac21adda107edb75a5dcc0bf Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 4 Jan 2024 10:31:00 +0100 Subject: [PATCH 02/20] chore: add file --- .../graph_tooling/queries/polymarket.py | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py new file mode 100644 index 000000000..2856515dc --- /dev/null +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- +# ------------------------------------------------------------------------------ +# +# Copyright 2023 Valory AG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ------------------------------------------------------------------------------ + +"""Polymarket queries.""" + +from string import Template + + +questions = Template( + """ + { + fixedProductMarketMakers( + where: { + creator_in: ${creators}, + outcomeSlotCount: ${slot_count}, + openingTimestamp_gt: ${opening_threshold}, + + isPendingArbitration: false + }, + orderBy: creationTimestamp + orderDirection: desc + first: 1000 + ){ + id + title + collateralToken { + id + name + symbol + } + creator + fee + outcomeSlotCount + outcomeTokenAmounts + outcomeTokenPrices + scaledLiquidityParameter + } + } + """ +) + +# Missing fields: +# language_in: ${languages}, +# openingTimestamp +# outcomes + + +# Different fields: +# outcomeTokenMarginalPrices == outcomeTokenPrices ? +# scaledLiquidityParameter == scaledLiquidityMeasure ? + + +trades = Template( + """ + { + fpmmTrades ( + where: { + type: Buy, + creator: "${creator}", + fpmm_: { + creationTimestamp_gt: "${creationTimestamp_gt}", + answerFinalizedTimestamp_not: null, + isPendingArbitration: false + } + } + orderBy: fpmm__creationTimestamp + orderDirection: asc + first: ${first} + ){ + fpmm { + answerFinalizedTimestamp + collateralToken + condition { + id + outcomeSlotCount + } + creator + creationTimestamp + currentAnswer + question { + id + data + } + templateId + } + outcomeIndex + outcomeTokenMarginalPrice + outcomeTokensTraded + transactionHash + } + } + """ +) From aa9a3303bf1a07a751ad80289299a36996208b28 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 4 Jan 2024 15:34:43 +0100 Subject: [PATCH 03/20] chore: add polymarket calls --- packages/packages.json | 12 +++--- packages/valory/agents/trader/aea-config.yaml | 9 ++--- packages/valory/services/trader/service.yaml | 3 +- .../skills/decision_maker_abci/skill.yaml | 2 +- .../graph_tooling/queries/polymarket.py | 8 ++-- .../graph_tooling/requests.py | 38 ++++++++++++++++--- .../skills/market_manager_abci/skill.yaml | 6 +-- packages/valory/skills/trader_abci/models.py | 2 + packages/valory/skills/trader_abci/skill.yaml | 20 ++++++++-- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 10 files changed, 71 insertions(+), 31 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index e9af81443..2ea26769c 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y", - "skill/valory/decision_maker_abci/0.1.0": "bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq", - "skill/valory/trader_abci/0.1.0": "bafybeia5innpj6zaa2ed3krl67k5hdvch73m3u7brvupfy3f3yrfogy4lm", + "skill/valory/market_manager_abci/0.1.0": "bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u", + "skill/valory/decision_maker_abci/0.1.0": "bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e", + "skill/valory/trader_abci/0.1.0": "bafybeidthqf3petdm5mdgnmatkkcgnq3zmiwux5t3sio6mugz2id5jsi74", "contract/valory/market_maker/0.1.0": "bafybeiain372i5t6eteem36vzhwh6ppka6hc4oyrxjtyzuar6rd6bjocem", - "agent/valory/trader/0.1.0": "bafybeidjhdxb75amxwvkcrk7hjjyvvparzso2ljkiu5s7ava3onzxjtdre", - "service/valory/trader/0.1.0": "bafybeibgkrlkpewpjiwbfuhhllu5ua4srn6nptesjzbwfdmikfbjs4urwq", + "agent/valory/trader/0.1.0": "bafybeib3ptntaeq457pfsbrqjpgr4kdmvvpotk72a62tycrxxlrv2o6y5i", + "service/valory/trader/0.1.0": "bafybeifwevw2hprg755vis7uon44gxc5wvnsfj35lm7j3a264lmimcidt4", "contract/valory/erc20/0.1.0": "bafybeiad6qbyhr3sgvclqne7tvyvqt32pcj5aq47hhkd2vmawaflhy5vna", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au", "contract/valory/mech/0.1.0": "bafybeiauxqogu726oeethvzux6r77zgn7sw5j2l4uigqb47zlqawblkv6e", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "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 7ae37c1ff..42340684b 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:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi -- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y -- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq -- valory/trader_abci:0.1.0:bafybeia5innpj6zaa2ed3krl67k5hdvch73m3u7brvupfy3f3yrfogy4lm +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au +- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u +- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e +- valory/trader_abci:0.1.0:bafybeidthqf3petdm5mdgnmatkkcgnq3zmiwux5t3sio6mugz2id5jsi74 - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy default_ledger: ethereum required_ledgers: @@ -158,7 +158,6 @@ models: use_termination: ${bool:false} on_chain_service_id: ${int:null} creator_per_subgraph: - omen_subgraph: ${list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} polymarket_subgraph: ${list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${int:2} opening_margin: ${int:300} diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 98d912b93..13b1feceb 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:bafybeidjhdxb75amxwvkcrk7hjjyvvparzso2ljkiu5s7ava3onzxjtdre +agent: valory/trader:0.1.0:bafybeib3ptntaeq457pfsbrqjpgr4kdmvvpotk72a62tycrxxlrv2o6y5i number_of_agents: 4 deployment: {} --- @@ -71,7 +71,6 @@ type: skill validate_timeout: ${VALIDATE_TIMEOUT:int:1205} history_check_timeout: ${HISTORY_CHECK_TIMEOUT:int:1205} creator_per_subgraph: &id003 - omen_subgraph: ${OMEN_CREATORS:list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} polymarket_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${SLOT_COUNT:int:2} opening_margin: ${OPENING_MARGIN:int:300} diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 23dbd2cdc..fff348c96 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -65,7 +65,7 @@ protocols: - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y +- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py index 2856515dc..8ebe6b220 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py @@ -29,16 +29,12 @@ where: { creator_in: ${creators}, outcomeSlotCount: ${slot_count}, - openingTimestamp_gt: ${opening_threshold}, - - isPendingArbitration: false }, orderBy: creationTimestamp orderDirection: desc first: 1000 ){ id - title collateralToken { id name @@ -50,6 +46,10 @@ outcomeTokenAmounts outcomeTokenPrices scaledLiquidityParameter + conditions { + id + questionId + } } } """ diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index de2deeafd..5d72cea50 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -39,6 +39,9 @@ questions, trades, ) +from packages.valory.skills.market_manager_abci.graph_tooling.queries.polymarket import ( + questions as polymarket_questions, +) from packages.valory.skills.market_manager_abci.graph_tooling.queries.realitio import ( answers as answers_query, ) @@ -170,15 +173,40 @@ def _handle_response( def _fetch_bets(self) -> Generator[None, None, Optional[list]]: """Fetch questions from the current subgraph, for the current creators.""" - print(self.current_subgraph.get_spec()) - if self.current_subgraph == "omen_subgraph": - return self._fetch_bets_omen() - elif self.current_subgraph == "polymarket_subgraph": - return None + print(self.current_subgraph.api_id) + if self.current_subgraph.api_id == "omen": + yield from self._fetch_bets_omen() + elif self.current_subgraph.api_id == "polymarket": + yield from self._fetch_bets_polymarket() return None + def _fetch_bets_polymarket(self) -> Generator[None, None, Optional[list]]: + """Fetch questions from the current subgraph, for the current creators.""" + self._fetch_status = FetchStatus.IN_PROGRESS + + query = polymarket_questions.substitute( + creators=to_graphql_list(self._current_creators), + slot_count=self.params.slot_count, + ) + + res_raw = yield from self.get_http_response( + content=to_content(query), + **self.current_subgraph.get_spec(), + ) + res = self.current_subgraph.process_response(res_raw) + + bets = yield from self._handle_response( + self.current_subgraph, + res, + res_context="questions", + ) + + print(bets) + + return bets + def _fetch_bets_omen(self) -> Generator[None, None, Optional[list]]: """Fetch questions from the current subgraph, for the current creators.""" diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 6634c0ea8..4eba71f95 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -17,10 +17,10 @@ fingerprint: graph_tooling/queries/conditional_tokens.py: bafybeic6ohkdp4rvkcfglieksv6gbzm4qocpgdjaz4sroutl37sxijthji graph_tooling/queries/network.py: bafybeigeq72ys2nrjqspj2uacaudrgljrne5a3o5jvzsktldxdq6m2xmeu graph_tooling/queries/omen.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu - graph_tooling/queries/polymarket.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu + graph_tooling/queries/polymarket.py: bafybeihszfy6bjaxauvs4s3oncmict2qe6igmmglyz4tzsckpl4ml2s63q graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeibolslldpvfks27wsg2voe45jjzpv3fdzgp5bjau3hix7c5lhmpty + graph_tooling/requests.py: bafybeiamo2pctqe43gilsbgsac7g5jqgly34o7kutzcyn5kycveiyoaewi graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu models.py: bafybeieg7hfldv7lumasttqojiptbpxvrerpoay3e43f6fqenu4h3u7xmy @@ -171,7 +171,7 @@ models: class_name: OmenSubgraph polymarket_subgraph: args: - api_id: omen + api_id: polymarket headers: Content-Type: application/json method: POST diff --git a/packages/valory/skills/trader_abci/models.py b/packages/valory/skills/trader_abci/models.py index 45188a781..20e4779da 100644 --- a/packages/valory/skills/trader_abci/models.py +++ b/packages/valory/skills/trader_abci/models.py @@ -53,6 +53,7 @@ ) from packages.valory.skills.market_manager_abci.models import ( OmenSubgraph as MarketManagerOmenSubgraph, + PolymarketSubgraph as MarketManagerPolymarketSubgraph, ) from packages.valory.skills.market_manager_abci.rounds import ( Event as MarketManagerEvent, @@ -82,6 +83,7 @@ Requests = BaseRequests BenchmarkTool = BaseBenchmarkTool OmenSubgraph = MarketManagerOmenSubgraph +PolymarketSubgraph = MarketManagerPolymarketSubgraph NetworkSubgraph = MarketManagerNetworkSubgraph MechResponseSpecs = DecisionMakerMechResponseSpecs AgentToolsSpecs = DecisionMakerAgentToolsSpecs diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 45d86be49..5f6d41238 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -13,7 +13,7 @@ fingerprint: dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a - models.py: bafybeibrxivgpzamfmrl6bdngi67g72i32lmu5vgdn3jbwka265blk7ire + models.py: bafybeibqxwlfy5z4sedpk4d27ftrxpv3rqti3gtvw6rkb63nbbuooejsma fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeify5v5pdhu5kikkcxtqejent6kzx3b2acmqk53nudvsntlmk3av2y -- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifxazxsi6hqg7qoq6mxta2oqapaz7sldo6n4feogz4w7vqdgzqubi +- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u +- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: @@ -229,6 +229,18 @@ models: retries: 5 url: https://api.thegraph.com/subgraphs/name/protofire/omen-xdai class_name: OmenSubgraph + polymarket_subgraph: + args: + api_id: polymarket + headers: + Content-Type: application/json + method: POST + parameters: {} + response_key: data:fixedProductMarketMakers + response_type: list + retries: 5 + url: https://api.thegraph.com/subgraphs/name/polymarket/matic-markets + class_name: PolymarketSubgraph randomness_api: args: api_id: cloudflare diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 29b208020..910a0cc7b 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeibd5x6s2rlqqrrp7iwerpnlfznstwyuwfkkf563kaw7qna2sp65xq +- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: From d004f2345bf31b27c343eb52c1bc5a2698e838d6 Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 4 Jan 2024 20:06:37 +0100 Subject: [PATCH 04/20] feat: polymarket collection --- packages/packages.json | 12 ++--- packages/valory/agents/trader/aea-config.yaml | 10 ++-- packages/valory/services/trader/service.yaml | 6 +-- .../skills/decision_maker_abci/models.py | 2 +- .../skills/decision_maker_abci/skill.yaml | 4 +- .../skills/market_manager_abci/behaviours.py | 2 +- .../graph_tooling/queries/polymarket.py | 26 ++++++++- .../graph_tooling/requests.py | 54 ++++++++++++++----- .../skills/market_manager_abci/models.py | 6 ++- .../skills/market_manager_abci/skill.yaml | 23 +++++--- packages/valory/skills/trader_abci/models.py | 2 + packages/valory/skills/trader_abci/skill.yaml | 23 +++++--- .../tx_settlement_multiplexer_abci/skill.yaml | 2 +- 13 files changed, 125 insertions(+), 47 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 2ea26769c..e7b84df5b 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u", - "skill/valory/decision_maker_abci/0.1.0": "bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e", - "skill/valory/trader_abci/0.1.0": "bafybeidthqf3petdm5mdgnmatkkcgnq3zmiwux5t3sio6mugz2id5jsi74", + "skill/valory/market_manager_abci/0.1.0": "bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe", + "skill/valory/decision_maker_abci/0.1.0": "bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e", + "skill/valory/trader_abci/0.1.0": "bafybeiabsjvqw7cfsyjnwboffzlt375twrqul5ts7hozxq6ed7upulcjam", "contract/valory/market_maker/0.1.0": "bafybeiain372i5t6eteem36vzhwh6ppka6hc4oyrxjtyzuar6rd6bjocem", - "agent/valory/trader/0.1.0": "bafybeib3ptntaeq457pfsbrqjpgr4kdmvvpotk72a62tycrxxlrv2o6y5i", - "service/valory/trader/0.1.0": "bafybeifwevw2hprg755vis7uon44gxc5wvnsfj35lm7j3a264lmimcidt4", + "agent/valory/trader/0.1.0": "bafybeiakutkpxhipmd7gipuy5jiid6sox5czdbfze5srciztwyxuzssmhu", + "service/valory/trader/0.1.0": "bafybeiaeh5ilpdp7evgxxezfsij427xgehhmh4577k3oi7m6honxhq7ody", "contract/valory/erc20/0.1.0": "bafybeiad6qbyhr3sgvclqne7tvyvqt32pcj5aq47hhkd2vmawaflhy5vna", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu", "contract/valory/mech/0.1.0": "bafybeiauxqogu726oeethvzux6r77zgn7sw5j2l4uigqb47zlqawblkv6e", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "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 42340684b..6fa1ffe03 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:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au -- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u -- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e -- valory/trader_abci:0.1.0:bafybeidthqf3petdm5mdgnmatkkcgnq3zmiwux5t3sio6mugz2id5jsi74 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu +- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe +- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e +- valory/trader_abci:0.1.0:bafybeiabsjvqw7cfsyjnwboffzlt375twrqul5ts7hozxq6ed7upulcjam - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy default_ledger: ethereum required_ledgers: @@ -158,7 +158,7 @@ models: use_termination: ${bool:false} on_chain_service_id: ${int:null} creator_per_subgraph: - polymarket_subgraph: ${list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} + polymarket_gamma_subgraph: ${list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${int:2} opening_margin: ${int:300} languages: ${list:["en_US"]} diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 13b1feceb..8945549d1 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:bafybeib3ptntaeq457pfsbrqjpgr4kdmvvpotk72a62tycrxxlrv2o6y5i +agent: valory/trader:0.1.0:bafybeiakutkpxhipmd7gipuy5jiid6sox5czdbfze5srciztwyxuzssmhu number_of_agents: 4 deployment: {} --- @@ -71,7 +71,7 @@ type: skill validate_timeout: ${VALIDATE_TIMEOUT:int:1205} history_check_timeout: ${HISTORY_CHECK_TIMEOUT:int:1205} creator_per_subgraph: &id003 - polymarket_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} + polymarket_gamma_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${SLOT_COUNT:int:2} opening_margin: ${OPENING_MARGIN:int:300} languages: ${LANGUAGES:list:["en_US"]} @@ -163,7 +163,7 @@ type: skill abt_error_mult: ${ABT_ERROR_MULT:int:5} mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} - trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} + trading_strategy: ${TRADING_STRATEGY:str:bet_amount_per_threshold} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} bet_threshold: ${BET_THRESHOLD:int:100000000000000000} blacklisting_duration: ${BLACKLISTING_DURATION:int:3600} diff --git a/packages/valory/skills/decision_maker_abci/models.py b/packages/valory/skills/decision_maker_abci/models.py index fa351eb3f..48b684b93 100644 --- a/packages/valory/skills/decision_maker_abci/models.py +++ b/packages/valory/skills/decision_maker_abci/models.py @@ -69,7 +69,7 @@ DEFAULT_FROM_BLOCK = "earliest" ZERO_HEX = HASH_ZERO[2:] ZERO_BYTES = bytes.fromhex(ZERO_HEX) -STRATEGY_BET_AMOUNT_PER_CONF_THRESHOLD = "bet_amount_per_conf_threshold" +STRATEGY_BET_AMOUNT_PER_CONF_THRESHOLD = "bet_amount_per_threshold" STRATEGY_KELLY_CRITERION = "kelly_criterion" diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index fff348c96..804edd3ea 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -27,7 +27,7 @@ fingerprint: handlers.py: bafybeiggoetspwcvdojmbjdd67tmkoeedikmt6vsbcium3zjaljb6jzqu4 io_/__init__.py: bafybeifxgmmwjqzezzn3e6keh2bfo4cyo7y5dq2ept3stfmgglbrzfl5rq io_/loader.py: bafybeih3sdsx5dhe4kzhtoafexjgkutsujwqy3zcdrlrkhtdks45bc7exa - models.py: bafybeif63pruksc6fpvmg77jmsrphc36uiawypzzcrk6nbpzoglbpxnlfy + models.py: bafybeiekknd5xy3k3dgrbk3cx7fvj2htzpow7xtjl72je4x2ff3zg3cqtu payloads.py: bafybeigcic4vewdglakzpyqevhfwsolh4ywnbvxo5bgned7gl5uo3jif7m policy.py: bafybeidpmx4ek3qze63zpuwixyf6t7bdv62ewgkzt3ljrzadiwdw64cueq redeem_info.py: bafybeifiiix4gihfo4avraxt34sfw35v6dqq45do2drrssei2shbps63mm @@ -65,7 +65,7 @@ protocols: - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u +- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: diff --git a/packages/valory/skills/market_manager_abci/behaviours.py b/packages/valory/skills/market_manager_abci/behaviours.py index 03d130587..4a2bef25f 100644 --- a/packages/valory/skills/market_manager_abci/behaviours.py +++ b/packages/valory/skills/market_manager_abci/behaviours.py @@ -83,6 +83,7 @@ def _update_bets( break bets_market_chunk = yield from self._fetch_bets() + if bets_market_chunk is not None: bets_updates = ( Bet(**bet, market=self._current_market) @@ -95,7 +96,6 @@ def _update_bets( self.bets = [] self.context.logger.info(f"Updated bets: {self.bets}") - exit(0) def async_act(self) -> Generator: """Do the action.""" diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py index 8ebe6b220..3cf9e4c99 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py @@ -22,12 +22,34 @@ from string import Template -questions = Template( +questions_polymarket_gamma = Template( + """ + { + markets( + where: "active=true AND closed=false AND outcomes='[\\\"Yes\\\", \\\"No\\\"]'" + order: "start_date DESC" + limit: 100 + ) { + marketMakerAddress + question + denominationToken + createdBy + fee + endDate + outcomes + outcomePrices + liquidity + } + } + """ +) + + +questions_polymarket = Template( """ { fixedProductMarketMakers( where: { - creator_in: ${creators}, outcomeSlotCount: ${slot_count}, }, orderBy: creationTimestamp diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index 5d72cea50..d12a93229 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -22,6 +22,7 @@ import json from abc import ABC +from datetime import datetime, timezone from enum import Enum, auto from typing import Any, Dict, Generator, Iterator, List, Optional, Tuple, cast @@ -40,7 +41,7 @@ trades, ) from packages.valory.skills.market_manager_abci.graph_tooling.queries.polymarket import ( - questions as polymarket_questions, + questions_polymarket_gamma, ) from packages.valory.skills.market_manager_abci.graph_tooling.queries.realitio import ( answers as answers_query, @@ -175,19 +176,18 @@ def _fetch_bets(self) -> Generator[None, None, Optional[list]]: """Fetch questions from the current subgraph, for the current creators.""" print(self.current_subgraph.api_id) if self.current_subgraph.api_id == "omen": - yield from self._fetch_bets_omen() - elif self.current_subgraph.api_id == "polymarket": - yield from self._fetch_bets_polymarket() - - return None + return self._fetch_bets_omen() + elif self.current_subgraph.api_id == "polymarket_gamma": + return self._fetch_bets_polymarket_gamma() + else: + raise ValueError("Unknown api_id: {}".format(self.current_subgraph.api_id)) - - def _fetch_bets_polymarket(self) -> Generator[None, None, Optional[list]]: + def _fetch_bets_polymarket_gamma(self) -> Generator[None, None, Optional[list]]: """Fetch questions from the current subgraph, for the current creators.""" self._fetch_status = FetchStatus.IN_PROGRESS - query = polymarket_questions.substitute( - creators=to_graphql_list(self._current_creators), + # TODO: we ignore 'creators' and simply fetch 100 latest markets. + query = questions_polymarket_gamma.substitute( slot_count=self.params.slot_count, ) @@ -203,9 +203,39 @@ def _fetch_bets_polymarket(self) -> Generator[None, None, Optional[list]]: res_context="questions", ) - print(bets) + # Transform received list to match Omen format + transformed_bets:list = [] + + if bets is not None: + for bet in bets: + scaled_liquidity_measure = 10.0 # Replace this with the actual calculation for scaled liquidity measure + outcomes = eval(bet['outcomes']) + outcome_token_amounts = ["0"] * len(outcomes) + + end_date = datetime.strptime(bet['endDate'], '%Y-%m-%dT%H:%M:%S.%fZ') + opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) + + new_bet = { + 'id': bet['marketMakerAddress'], + 'title': bet['question'], + 'collateralToken': '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', # TODO USDC + 'creator': bet['createdBy'] or '0x0000000000000000000000000000000000000000', # TODO Returns 'None' + 'fee': bet['fee'], + 'openingTimestamp': str(opening_timestamp), + 'outcomeSlotCount': len(outcomes), + 'outcomeTokenAmounts': outcome_token_amounts, # TODO Returns [0, 0] + 'outcomeTokenMarginalPrices': eval(bet['outcomePrices']), + 'outcomes': outcomes, + 'scaledLiquidityMeasure': bet['liquidity'] + } + + transformed_bets.append(new_bet) - return bets + #self.context.logger.info(json.dumps(transformed_bets, indent=2)) + self.context.logger.info(f"fetched bets len={len(json.dumps(transformed_bets, indent=2))}") + self.context.logger.info(self._fetch_status) + + return transformed_bets def _fetch_bets_omen(self) -> Generator[None, None, Optional[list]]: diff --git a/packages/valory/skills/market_manager_abci/models.py b/packages/valory/skills/market_manager_abci/models.py index 21d4feb0b..0e0c02642 100644 --- a/packages/valory/skills/market_manager_abci/models.py +++ b/packages/valory/skills/market_manager_abci/models.py @@ -47,9 +47,11 @@ class SharedState(BaseSharedState): class OmenSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" - class PolymarketSubgraph(ApiSpecs): - """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" + """A model that wraps ApiSpecs for the Polymarket subgraph specifications.""" + +class PolymarketGammaSubgraph(ApiSpecs): + """A model that wraps ApiSpecs for the Polymarket Gamma subgraph specifications.""" class NetworkSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the network's subgraph specifications.""" diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 4eba71f95..9a7ea55d4 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: README.md: bafybeie6miwn67uin3bphukmf7qgiifh4xtm42i5v3nuyqxzxtehxsqvcq __init__.py: bafybeigrtedqzlq5mtql2ssjsdriw76ml3666m4e2c3fay6vmyzofl6v6e - behaviours.py: bafybeig2yejepycsajbiq4spopsdlizfxfngwwae3xxddqp2r5c5zpgkwe + behaviours.py: bafybeicbjpx53x3hgiegr5v75vk2l3zqj6lcxycqsgp6kiewmtmo65eog4 bets.py: bafybeid5jw3o57bivq32ojphjmu3xoulf6y6r2pnzuhyp7u6nz3pojpbuu dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeic5cvwfbiu5pywyp3h5s2elvu7jqdrcwayay7o3v3ow47vu2jw53q @@ -17,13 +17,13 @@ fingerprint: graph_tooling/queries/conditional_tokens.py: bafybeic6ohkdp4rvkcfglieksv6gbzm4qocpgdjaz4sroutl37sxijthji graph_tooling/queries/network.py: bafybeigeq72ys2nrjqspj2uacaudrgljrne5a3o5jvzsktldxdq6m2xmeu graph_tooling/queries/omen.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu - graph_tooling/queries/polymarket.py: bafybeihszfy6bjaxauvs4s3oncmict2qe6igmmglyz4tzsckpl4ml2s63q + graph_tooling/queries/polymarket.py: bafybeidbbqpwkh7diz4blwv7t7wtjyi5reb4haugqpodzb7rkwbyz2td24 graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeiamo2pctqe43gilsbgsac7g5jqgly34o7kutzcyn5kycveiyoaewi + graph_tooling/requests.py: bafybeih7xfqo3usqv7lxowzktcwwc7ddmekey5y4raiepajmatxxxwezjm graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu - models.py: bafybeieg7hfldv7lumasttqojiptbpxvrerpoay3e43f6fqenu4h3u7xmy + models.py: bafybeihdb272u5vpi4a3p6rzvec5tznweywghwrdpr3qzdmvtirszc44sq payloads.py: bafybeiamavgddfbzofpsjthmw6j7g2dyxm7fb6hvdb47kweyrx4w2ihcfi rounds.py: bafybeihsphyqat2sn46nukisxpvx5g2yfal4iyobhnoccbeavfz7xnhhri fingerprint_ignore_patterns: [] @@ -135,8 +135,7 @@ models: light_slash_unit_amount: 5000000000000000 serious_slash_unit_amount: 8000000000000000 creator_per_subgraph: - omen_subgraph: [] - polymarket_subgraph: [] + polymarket_gamma_subgraph: [] slot_count: 2 opening_margin: 300 languages: @@ -181,6 +180,18 @@ models: retries: 5 url: https://api.thegraph.com/subgraphs/name/polymarket/matic-markets class_name: PolymarketSubgraph + polymarket_gamma_subgraph: + args: + api_id: polymarket_gamma + headers: + Content-Type: application/json + method: POST + parameters: {} + response_key: data:markets + response_type: list + retries: 5 + url: https://gamma-api.polymarket.com/query + class_name: PolymarketGammaSubgraph requests: args: {} class_name: Requests diff --git a/packages/valory/skills/trader_abci/models.py b/packages/valory/skills/trader_abci/models.py index 20e4779da..1ec4df8c2 100644 --- a/packages/valory/skills/trader_abci/models.py +++ b/packages/valory/skills/trader_abci/models.py @@ -54,6 +54,7 @@ from packages.valory.skills.market_manager_abci.models import ( OmenSubgraph as MarketManagerOmenSubgraph, PolymarketSubgraph as MarketManagerPolymarketSubgraph, + PolymarketGammaSubgraph as MarketManagerPolyMarketGammaSubgraph ) from packages.valory.skills.market_manager_abci.rounds import ( Event as MarketManagerEvent, @@ -84,6 +85,7 @@ BenchmarkTool = BaseBenchmarkTool OmenSubgraph = MarketManagerOmenSubgraph PolymarketSubgraph = MarketManagerPolymarketSubgraph +PolymarketGammaSubgraph = MarketManagerPolyMarketGammaSubgraph NetworkSubgraph = MarketManagerNetworkSubgraph MechResponseSpecs = DecisionMakerMechResponseSpecs AgentToolsSpecs = DecisionMakerAgentToolsSpecs diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 5f6d41238..458a78633 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -13,7 +13,7 @@ fingerprint: dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeib3ycl5bjo5uilyaly7uoovvc3b3gpjrkuvdos5ffsgmrs73j6bkm handlers.py: bafybeibkiqwe7hoqccjirimd44nzeqkabc7oo74romqklssion27s5sa2a - models.py: bafybeibqxwlfy5z4sedpk4d27ftrxpv3rqti3gtvw6rkb63nbbuooejsma + models.py: bafybeieno72z37gyjljwrcf3hqojyjppcayr2ngcbs74iid7jcir4ywkzi fingerprint_ignore_patterns: [] connections: [] contracts: [] @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeiefbhojckblkkhj6ms4addd4rr6z7fb7dmhn5x3glcun4plojn76u -- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeigczuund26tqjbvkoqiv6knk4rzxns53ti7z4vafoptn6zqixd5au +- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe +- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: @@ -137,8 +137,7 @@ models: use_termination: false validate_timeout: 1205 creator_per_subgraph: - omen_subgraph: [] - polymarket_subgraph: [] + polymarket_gamma_subgraph: [] slot_count: 2 opening_margin: 300 languages: @@ -241,6 +240,18 @@ models: retries: 5 url: https://api.thegraph.com/subgraphs/name/polymarket/matic-markets class_name: PolymarketSubgraph + polymarket_gamma_subgraph: + args: + api_id: polymarket_gamma + headers: + Content-Type: application/json + method: POST + parameters: {} + response_key: data:markets + response_type: list + retries: 5 + url: https://gamma-api.polymarket.com/query + class_name: PolymarketGammaSubgraph randomness_api: args: api_id: cloudflare diff --git a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml index 910a0cc7b..acdc3b478 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeidjwi45cpmjlcjpcolap6ffhg4cvt37spwr4bvzevcl7752doll2e +- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: From ed30ffbaaf3c10476dc642d388985c250afaeb8d Mon Sep 17 00:00:00 2001 From: jmoreira-valory Date: Thu, 4 Jan 2024 20:34:42 +0100 Subject: [PATCH 05/20] chore: update collateral token --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 4 ++-- .../decision_maker_abci/states/decision_receive.py | 3 +++ .../market_manager_abci/graph_tooling/requests.py | 3 ++- .../valory/skills/market_manager_abci/skill.yaml | 2 +- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 9 files changed, 23 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index e7b84df5b..696aff9ed 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe", - "skill/valory/decision_maker_abci/0.1.0": "bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e", - "skill/valory/trader_abci/0.1.0": "bafybeiabsjvqw7cfsyjnwboffzlt375twrqul5ts7hozxq6ed7upulcjam", + "skill/valory/market_manager_abci/0.1.0": "bafybeibk4bw6oqflohrfa7q6p57d2lpjxosmgypmlbphpnwfoem56b5m6e", + "skill/valory/decision_maker_abci/0.1.0": "bafybeihc73eueeo7sxzcxksrm2rqy4uem7d3dr6dc2vdmjwlagucuzo75i", + "skill/valory/trader_abci/0.1.0": "bafybeibtcxuvffnhsovwuc5vpnrjpizg4mg2qq5ic7esntqpien3p324wi", "contract/valory/market_maker/0.1.0": "bafybeiain372i5t6eteem36vzhwh6ppka6hc4oyrxjtyzuar6rd6bjocem", - "agent/valory/trader/0.1.0": "bafybeiakutkpxhipmd7gipuy5jiid6sox5czdbfze5srciztwyxuzssmhu", - "service/valory/trader/0.1.0": "bafybeiaeh5ilpdp7evgxxezfsij427xgehhmh4577k3oi7m6honxhq7ody", + "agent/valory/trader/0.1.0": "bafybeiarpf4zgpbvy5kll3mml4vnrzdbu5s42pgyhbafnen6rad2ym5vg4", + "service/valory/trader/0.1.0": "bafybeihh2q2g3ll45x2h5moiy6fpxu3tgn6hroqvuirpf7o54q67z47jey", "contract/valory/erc20/0.1.0": "bafybeiad6qbyhr3sgvclqne7tvyvqt32pcj5aq47hhkd2vmawaflhy5vna", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeiggih65pks7qajuxzbbksrfcr6cqeje3urlmk6wkqi4xhbbu4tdhm", "contract/valory/mech/0.1.0": "bafybeiauxqogu726oeethvzux6r77zgn7sw5j2l4uigqb47zlqawblkv6e", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "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 6fa1ffe03..bded0b0f8 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:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu -- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe -- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e -- valory/trader_abci:0.1.0:bafybeiabsjvqw7cfsyjnwboffzlt375twrqul5ts7hozxq6ed7upulcjam +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiggih65pks7qajuxzbbksrfcr6cqeje3urlmk6wkqi4xhbbu4tdhm +- valory/market_manager_abci:0.1.0:bafybeibk4bw6oqflohrfa7q6p57d2lpjxosmgypmlbphpnwfoem56b5m6e +- valory/decision_maker_abci:0.1.0:bafybeihc73eueeo7sxzcxksrm2rqy4uem7d3dr6dc2vdmjwlagucuzo75i +- valory/trader_abci:0.1.0:bafybeibtcxuvffnhsovwuc5vpnrjpizg4mg2qq5ic7esntqpien3p324wi - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 8945549d1..d287b3a19 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:bafybeiakutkpxhipmd7gipuy5jiid6sox5czdbfze5srciztwyxuzssmhu +agent: valory/trader:0.1.0:bafybeiarpf4zgpbvy5kll3mml4vnrzdbu5s42pgyhbafnen6rad2ym5vg4 number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 804edd3ea..2ecfbd632 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -36,7 +36,7 @@ fingerprint: states/base.py: bafybeibhcc4pc3m6qelvdvxssnuglcwfaff55cr2kule74ekauyf3bahpq states/bet_placement.py: bafybeibalhxhp2c4oljmiwqi6ds3g36fgtabmf42mb5sgq6z22znrcbhda states/blacklisting.py: bafybeifruvxwwltndwazkzzbpc5nnnad3z5t5ofy6d3i7nssljbxl6gvxu - states/decision_receive.py: bafybeib3roo27nccj4eylaqwwzztzzzwsi6px5atjrch5wbqmpln2kyy6y + states/decision_receive.py: bafybeiedksn6q526scn7g4bmyh3lctkqypytrfj2wdredropl7jdw2oiwq states/decision_request.py: bafybeic7otc3hjb753svbmur3yyk6szahc25yii3x4w4vcnpfz6jwvacuu states/final_states.py: bafybeidiwhuyd5zm2cq7vhv2owcrxdpm7fnvn3db6p6tql4jz5hgpalflu states/handle_failed_tx.py: bafybeihewm2vernvhktuorljdupjqcg2p5vs6wvsira2d62wkoyo5xlzjm @@ -65,7 +65,7 @@ protocols: - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe +- valory/market_manager_abci:0.1.0:bafybeibk4bw6oqflohrfa7q6p57d2lpjxosmgypmlbphpnwfoem56b5m6e - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: diff --git a/packages/valory/skills/decision_maker_abci/states/decision_receive.py b/packages/valory/skills/decision_maker_abci/states/decision_receive.py index a45b9ecd2..0b378763b 100644 --- a/packages/valory/skills/decision_maker_abci/states/decision_receive.py +++ b/packages/valory/skills/decision_maker_abci/states/decision_receive.py @@ -63,4 +63,7 @@ def end_block(self) -> Optional[Tuple[SynchronizedData, Enum]]: if event == Event.DONE and not synced_data.is_profitable: return synced_data, Event.UNPROFITABLE + # TODO + print("EXITING THE SERVICE.") + exit(0) return synced_data, event diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index d12a93229..07d6d46ab 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -218,7 +218,8 @@ def _fetch_bets_polymarket_gamma(self) -> Generator[None, None, Optional[list]]: new_bet = { 'id': bet['marketMakerAddress'], 'title': bet['question'], - 'collateralToken': '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', # TODO USDC + #'collateralToken': '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', # TODO Not available on this subgraph. Usually, USDC + 'collateralToken': '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d', # TODO WxDAI - this is use temporarily to test the service. 'creator': bet['createdBy'] or '0x0000000000000000000000000000000000000000', # TODO Returns 'None' 'fee': bet['fee'], 'openingTimestamp': str(opening_timestamp), diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 9a7ea55d4..b0c68bd94 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -20,7 +20,7 @@ fingerprint: graph_tooling/queries/polymarket.py: bafybeidbbqpwkh7diz4blwv7t7wtjyi5reb4haugqpodzb7rkwbyz2td24 graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeih7xfqo3usqv7lxowzktcwwc7ddmekey5y4raiepajmatxxxwezjm + graph_tooling/requests.py: bafybeif5g2mgiki2gbpoifqhmtsa53c2a2iekmyrfcszh4xah27cybsvte graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu models.py: bafybeihdb272u5vpi4a3p6rzvec5tznweywghwrdpr3qzdmvtirszc44sq diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 458a78633..ac5027453 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeia63r6jv34exkxpqneopp2abuxscsgnzcfhx2ttrjwanvkugnoohe -- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihr46rdmos7rvaj75mg7bha2dzjpegcuvtyk2vhxwkwgrxlx5ljwu +- valory/market_manager_abci:0.1.0:bafybeibk4bw6oqflohrfa7q6p57d2lpjxosmgypmlbphpnwfoem56b5m6e +- valory/decision_maker_abci:0.1.0:bafybeihc73eueeo7sxzcxksrm2rqy4uem7d3dr6dc2vdmjwlagucuzo75i +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeiggih65pks7qajuxzbbksrfcr6cqeje3urlmk6wkqi4xhbbu4tdhm - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy 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 acdc3b478..51fafba93 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeignilzah3a7sflaehlhfblwr2k6yluo3q2gu373erpcjo6yws7m5e +- valory/decision_maker_abci:0.1.0:bafybeihc73eueeo7sxzcxksrm2rqy4uem7d3dr6dc2vdmjwlagucuzo75i - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: From 0f3a62162587d9f4db31e18c7c43a729e0a45b08 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:22:12 +0200 Subject: [PATCH 06/20] chore: remove test code introduced in ed30ffb --- .../skills/decision_maker_abci/states/decision_receive.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/valory/skills/decision_maker_abci/states/decision_receive.py b/packages/valory/skills/decision_maker_abci/states/decision_receive.py index 0b378763b..a45b9ecd2 100644 --- a/packages/valory/skills/decision_maker_abci/states/decision_receive.py +++ b/packages/valory/skills/decision_maker_abci/states/decision_receive.py @@ -63,7 +63,4 @@ def end_block(self) -> Optional[Tuple[SynchronizedData, Enum]]: if event == Event.DONE and not synced_data.is_profitable: return synced_data, Event.UNPROFITABLE - # TODO - print("EXITING THE SERVICE.") - exit(0) return synced_data, event From 8c5806e057ec43a3dc6c213d3f14084552239ecb Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:23:59 +0200 Subject: [PATCH 07/20] revert: changes in service's defaults from d004f234 --- packages/valory/services/trader/service.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index d287b3a19..9297a27ea 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -71,7 +71,7 @@ type: skill validate_timeout: ${VALIDATE_TIMEOUT:int:1205} history_check_timeout: ${HISTORY_CHECK_TIMEOUT:int:1205} creator_per_subgraph: &id003 - polymarket_gamma_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} + omen_subgraph: ${OMEN_CREATORS:list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} slot_count: ${SLOT_COUNT:int:2} opening_margin: ${OPENING_MARGIN:int:300} languages: ${LANGUAGES:list:["en_US"]} @@ -163,7 +163,7 @@ type: skill abt_error_mult: ${ABT_ERROR_MULT:int:5} mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81} sample_bets_closing_days: ${SAMPLE_BETS_CLOSING_DAYS:int:10} - trading_strategy: ${TRADING_STRATEGY:str:bet_amount_per_threshold} + trading_strategy: ${TRADING_STRATEGY:str:kelly_criterion} use_fallback_strategy: ${USE_FALLBACK_STRATEGY:bool:true} bet_threshold: ${BET_THRESHOLD:int:100000000000000000} blacklisting_duration: ${BLACKLISTING_DURATION:int:3600} From e06a52dee6f24e9a67b1b3f425b954ee4dc9427b Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:24:11 +0200 Subject: [PATCH 08/20] docs: correct comment --- .../valory/skills/decision_maker_abci/behaviours/sampling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/valory/skills/decision_maker_abci/behaviours/sampling.py b/packages/valory/skills/decision_maker_abci/behaviours/sampling.py index a74cf81ab..17a3fbdbd 100644 --- a/packages/valory/skills/decision_maker_abci/behaviours/sampling.py +++ b/packages/valory/skills/decision_maker_abci/behaviours/sampling.py @@ -48,7 +48,7 @@ def available_bets(self) -> Iterator[Bet]: # Note: the openingTimestamp is misleading as it is the closing timestamp of the bet if self.params.using_kelly: - # get only bets that close in the next 48 hours + # get only bets that close in the next `sample_bets_closing_days` bets = [ bet for bet in bets From 0bf24ebf25914e9a489c3a80b7901d6e643215a1 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:28:10 +0200 Subject: [PATCH 09/20] feat: classmethod to construct a `Bet` from gamma attributes --- .../valory/skills/market_manager_abci/bets.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/valory/skills/market_manager_abci/bets.py b/packages/valory/skills/market_manager_abci/bets.py index 129ae1a94..7522d5a84 100644 --- a/packages/valory/skills/market_manager_abci/bets.py +++ b/packages/valory/skills/market_manager_abci/bets.py @@ -24,11 +24,23 @@ import dataclasses import json import sys +from datetime import datetime, timezone from enum import Enum, auto from typing import Any, Dict, List, Optional, Union BINARY_N_SLOTS = 2 +USDC = "0x2791bca1f2de4661ed88a30c99a7a9449aa84174" +NULL_ADDRESS = "0x" + "0" * 40 +OMEN_TO_POLYWRAP = dict( + id="marketMakerAddress", + market="market", + title="question", + creator="createdBy", + fee="fee", + outcomeTokenMarginalPrices="outcomePrices", + scaledLiquidityMeasure="liquidity", +) class BetStatus(Enum): @@ -58,6 +70,31 @@ class Bet: status: BetStatus = BetStatus.UNPROCESSED blacklist_expiration: float = -1 + @classmethod + def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": + """Initialize a bet's instance from gamma subgraph's attributes.""" + outcomes = eval(kwargs["outcomes"]) + outcome_token_amounts = [0] * len(outcomes) + end_date = datetime.strptime(kwargs["endDate"], "%Y-%m-%dT%H:%M:%S.%fZ") + opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) + + kwargs["createdBy"] = kwargs["createdBy"] or NULL_ADDRESS + kwargs["outcomePrices"] = eval(kwargs["outcomePrices"]) + + omen_to_polywrap_mapping = { + omen_key: kwargs[polywrap_key] + for omen_key, polywrap_key in OMEN_TO_POLYWRAP.items() + } + + return cls( + collateralToken=USDC, + openingTimestamp=opening_timestamp, + outcomeSlotCount=len(outcomes), + outcomeTokenAmounts=outcome_token_amounts, + outcomes=outcomes, + **omen_to_polywrap_mapping, + ) + def __post_init__(self) -> None: """Post initialization to adjust the values.""" self._validate() From dfc4949524106d5d7e32465631156613bd044ca2 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:27:09 +0200 Subject: [PATCH 10/20] fix: the fetching logic --- .../skills/market_manager_abci/behaviours.py | 5 +- .../graph_tooling/requests.py | 103 ++++-------------- 2 files changed, 26 insertions(+), 82 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/behaviours.py b/packages/valory/skills/market_manager_abci/behaviours.py index 4a2bef25f..a3e0df5cb 100644 --- a/packages/valory/skills/market_manager_abci/behaviours.py +++ b/packages/valory/skills/market_manager_abci/behaviours.py @@ -82,11 +82,10 @@ def _update_bets( if not can_proceed: break - bets_market_chunk = yield from self._fetch_bets() - + bets_market_chunk, deserializer = yield from self._fetch_bets() if bets_market_chunk is not None: bets_updates = ( - Bet(**bet, market=self._current_market) + deserializer(**bet, market=self._current_market) for bet in bets_market_chunk if bet.get("id", "") not in existing_ids ) diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index 07d6d46ab..d13e9a960 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -22,14 +22,14 @@ import json from abc import ABC -from datetime import datetime, timezone from enum import Enum, auto -from typing import Any, Dict, Generator, Iterator, List, Optional, Tuple, cast +from typing import Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple, cast from web3 import Web3 from packages.valory.skills.abstract_round_abci.behaviour_utils import BaseBehaviour from packages.valory.skills.abstract_round_abci.models import ApiSpecs +from packages.valory.skills.market_manager_abci.bets import Bet from packages.valory.skills.market_manager_abci.graph_tooling.queries.conditional_tokens import ( user_positions as user_positions_query, ) @@ -37,9 +37,9 @@ block_number, ) from packages.valory.skills.market_manager_abci.graph_tooling.queries.omen import ( - questions, - trades, + questions as questions_omen, ) +from packages.valory.skills.market_manager_abci.graph_tooling.queries.omen import trades from packages.valory.skills.market_manager_abci.graph_tooling.queries.polymarket import ( questions_polymarket_gamma, ) @@ -51,6 +51,8 @@ ) from packages.valory.skills.market_manager_abci.models import ( MarketManagerParams, + OmenSubgraph, + PolymarketSubgraph, SharedState, ) from packages.valory.skills.market_manager_abci.rounds import SynchronizedData @@ -172,83 +174,26 @@ def _handle_response( self._fetch_status = FetchStatus.SUCCESS return res - def _fetch_bets(self) -> Generator[None, None, Optional[list]]: - """Fetch questions from the current subgraph, for the current creators.""" - print(self.current_subgraph.api_id) - if self.current_subgraph.api_id == "omen": - return self._fetch_bets_omen() - elif self.current_subgraph.api_id == "polymarket_gamma": - return self._fetch_bets_polymarket_gamma() - else: - raise ValueError("Unknown api_id: {}".format(self.current_subgraph.api_id)) - - def _fetch_bets_polymarket_gamma(self) -> Generator[None, None, Optional[list]]: - """Fetch questions from the current subgraph, for the current creators.""" - self._fetch_status = FetchStatus.IN_PROGRESS - - # TODO: we ignore 'creators' and simply fetch 100 latest markets. - query = questions_polymarket_gamma.substitute( - slot_count=self.params.slot_count, - ) - - res_raw = yield from self.get_http_response( - content=to_content(query), - **self.current_subgraph.get_spec(), - ) - res = self.current_subgraph.process_response(res_raw) - - bets = yield from self._handle_response( - self.current_subgraph, - res, - res_context="questions", - ) - - # Transform received list to match Omen format - transformed_bets:list = [] - - if bets is not None: - for bet in bets: - scaled_liquidity_measure = 10.0 # Replace this with the actual calculation for scaled liquidity measure - outcomes = eval(bet['outcomes']) - outcome_token_amounts = ["0"] * len(outcomes) - - end_date = datetime.strptime(bet['endDate'], '%Y-%m-%dT%H:%M:%S.%fZ') - opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) - - new_bet = { - 'id': bet['marketMakerAddress'], - 'title': bet['question'], - #'collateralToken': '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', # TODO Not available on this subgraph. Usually, USDC - 'collateralToken': '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d', # TODO WxDAI - this is use temporarily to test the service. - 'creator': bet['createdBy'] or '0x0000000000000000000000000000000000000000', # TODO Returns 'None' - 'fee': bet['fee'], - 'openingTimestamp': str(opening_timestamp), - 'outcomeSlotCount': len(outcomes), - 'outcomeTokenAmounts': outcome_token_amounts, # TODO Returns [0, 0] - 'outcomeTokenMarginalPrices': eval(bet['outcomePrices']), - 'outcomes': outcomes, - 'scaledLiquidityMeasure': bet['liquidity'] - } - - transformed_bets.append(new_bet) - - #self.context.logger.info(json.dumps(transformed_bets, indent=2)) - self.context.logger.info(f"fetched bets len={len(json.dumps(transformed_bets, indent=2))}") - self.context.logger.info(self._fetch_status) - - return transformed_bets - - - def _fetch_bets_omen(self) -> Generator[None, None, Optional[list]]: + def _fetch_bets(self) -> Generator[None, None, Tuple[Optional[list], Callable]]: """Fetch questions from the current subgraph, for the current creators.""" self._fetch_status = FetchStatus.IN_PROGRESS - query = questions.substitute( - creators=to_graphql_list(self._current_creators), - slot_count=self.params.slot_count, - opening_threshold=self.synced_time + self.params.opening_margin, - languages=to_graphql_list(self.params.languages), - ) + if isinstance(self.current_subgraph, OmenSubgraph): + # TODO: we ignore 'creators' and simply fetch 100 latest markets. + query = questions_polymarket_gamma.substitute( + slot_count=self.params.slot_count, + ) + deserializer = Bet.from_gamma_subgraph + elif isinstance(self.current_subgraph, PolymarketSubgraph): + query = questions_omen.substitute( + creators=to_graphql_list(self._current_creators), + slot_count=self.params.slot_count, + opening_threshold=self.synced_time + self.params.opening_margin, + languages=to_graphql_list(self.params.languages), + ) + deserializer = Bet + else: + raise ValueError(f"Unknown API with id: {self.current_subgraph.api_id}!") res_raw = yield from self.get_http_response( content=to_content(query), @@ -262,7 +207,7 @@ def _fetch_bets_omen(self) -> Generator[None, None, Optional[list]]: res_context="questions", ) - return bets + return bets, deserializer def _fetch_redeem_info(self) -> Generator[None, None, Optional[list]]: """Fetch redeeming information from the current subgraph.""" From 6c6716e18f8976cb8a00912db66a91333101bea1 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:29:05 +0200 Subject: [PATCH 11/20] chore: run formatters --- packages/valory/skills/market_manager_abci/models.py | 3 +++ packages/valory/skills/trader_abci/models.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/valory/skills/market_manager_abci/models.py b/packages/valory/skills/market_manager_abci/models.py index 0e0c02642..417d0f68c 100644 --- a/packages/valory/skills/market_manager_abci/models.py +++ b/packages/valory/skills/market_manager_abci/models.py @@ -47,12 +47,15 @@ class SharedState(BaseSharedState): class OmenSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the OMEN's subgraph specifications.""" + class PolymarketSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the Polymarket subgraph specifications.""" + class PolymarketGammaSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the Polymarket Gamma subgraph specifications.""" + class NetworkSubgraph(ApiSpecs): """A model that wraps ApiSpecs for the network's subgraph specifications.""" diff --git a/packages/valory/skills/trader_abci/models.py b/packages/valory/skills/trader_abci/models.py index 1ec4df8c2..45abefae3 100644 --- a/packages/valory/skills/trader_abci/models.py +++ b/packages/valory/skills/trader_abci/models.py @@ -53,8 +53,12 @@ ) from packages.valory.skills.market_manager_abci.models import ( OmenSubgraph as MarketManagerOmenSubgraph, +) +from packages.valory.skills.market_manager_abci.models import ( + PolymarketGammaSubgraph as MarketManagerPolyMarketGammaSubgraph, +) +from packages.valory.skills.market_manager_abci.models import ( PolymarketSubgraph as MarketManagerPolymarketSubgraph, - PolymarketGammaSubgraph as MarketManagerPolyMarketGammaSubgraph ) from packages.valory.skills.market_manager_abci.rounds import ( Event as MarketManagerEvent, From 3d511041c3ad9a5b203f9c9cf9654eb70f8678d5 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 11:48:45 +0200 Subject: [PATCH 12/20] fix: `creator_per_subgraph` defaults --- packages/valory/agents/trader/aea-config.yaml | 1 + packages/valory/services/trader/service.yaml | 3 ++- packages/valory/skills/market_manager_abci/skill.yaml | 1 + packages/valory/skills/trader_abci/skill.yaml | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/valory/agents/trader/aea-config.yaml b/packages/valory/agents/trader/aea-config.yaml index c434033a1..cb6343c7a 100644 --- a/packages/valory/agents/trader/aea-config.yaml +++ b/packages/valory/agents/trader/aea-config.yaml @@ -158,6 +158,7 @@ models: use_termination: ${bool:false} on_chain_service_id: ${int:null} creator_per_subgraph: + omen_subgraph: ${list:[]} polymarket_gamma_subgraph: ${list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${int:2} opening_margin: ${int:300} diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index 3d871df0e..d107d6aa4 100644 --- a/packages/valory/services/trader/service.yaml +++ b/packages/valory/services/trader/service.yaml @@ -71,7 +71,8 @@ type: skill validate_timeout: ${VALIDATE_TIMEOUT:int:1205} history_check_timeout: ${HISTORY_CHECK_TIMEOUT:int:1205} creator_per_subgraph: &id003 - omen_subgraph: ${OMEN_CREATORS:list:["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]} + omen_subgraph: ${OMEN_CREATORS:list:[]} + polymarket_gamma_subgraph: ${POLYMARKET_CREATORS:list:["0x91430cad2d3975766499717fa0d66a78d814e5c5"]} slot_count: ${SLOT_COUNT:int:2} opening_margin: ${OPENING_MARGIN:int:300} languages: ${LANGUAGES:list:["en_US"]} diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index fdb6f5058..13932796e 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -135,6 +135,7 @@ models: light_slash_unit_amount: 5000000000000000 serious_slash_unit_amount: 8000000000000000 creator_per_subgraph: + omen_subgraph: [] polymarket_gamma_subgraph: [] slot_count: 2 opening_margin: 300 diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index ab3cbf2fb..86557190b 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -137,6 +137,7 @@ models: use_termination: false validate_timeout: 1205 creator_per_subgraph: + omen_subgraph: [] polymarket_gamma_subgraph: [] slot_count: 2 opening_margin: 300 From 97831601fed408f0fc917c2e212ae247b6dc24b7 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 12:30:12 +0200 Subject: [PATCH 13/20] fix: current subgraph condition --- .../skills/market_manager_abci/graph_tooling/requests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index ba18248a3..6c6c55d70 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -52,7 +52,7 @@ from packages.valory.skills.market_manager_abci.models import ( MarketManagerParams, OmenSubgraph, - PolymarketSubgraph, + PolymarketGammaSubgraph, SharedState, ) from packages.valory.skills.market_manager_abci.rounds import SynchronizedData @@ -178,13 +178,13 @@ def _fetch_bets(self) -> Generator[None, None, Tuple[Optional[list], Callable]]: """Fetch questions from the current subgraph, for the current creators.""" self._fetch_status = FetchStatus.IN_PROGRESS - if isinstance(self.current_subgraph, OmenSubgraph): + if isinstance(self.current_subgraph, PolymarketGammaSubgraph): # TODO: we ignore 'creators' and simply fetch 100 latest markets. query = questions_polymarket_gamma.substitute( slot_count=self.params.slot_count, ) deserializer = Bet.from_gamma_subgraph - elif isinstance(self.current_subgraph, PolymarketSubgraph): + elif isinstance(self.current_subgraph, OmenSubgraph): query = questions_omen.substitute( creators=to_graphql_list(self._current_creators), slot_count=self.params.slot_count, From 38b34ce0ce63bb04fb478bcf71c634a4a09e5abe Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 12:30:59 +0200 Subject: [PATCH 14/20] fix: ignore markets with an empty creators' list --- .../market_manager_abci/graph_tooling/requests.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py index 6c6c55d70..3e052a15b 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/requests.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/requests.py @@ -126,10 +126,12 @@ def current_subgraph(self) -> ApiSpecs: def _prepare_fetching(self) -> bool: """Prepare for fetching a bet.""" if self._fetch_status in (FetchStatus.SUCCESS, FetchStatus.NONE): - res = next(self._creators_iterator, None) - if res is None: - return False - self._current_market, self._current_creators = res + self._current_creators = [] + while len(self._current_creators) == 0: + res = next(self._creators_iterator, None) + if res is None: + return False + self._current_market, self._current_creators = res if self._fetch_status == FetchStatus.FAIL: return False From 19c47fa0600b3b1cae062ec64abd6d1ef9ae2629 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 12:31:34 +0200 Subject: [PATCH 15/20] refactor: `from_gamma_subgraph` [no ci] --- packages/valory/skills/market_manager_abci/bets.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/bets.py b/packages/valory/skills/market_manager_abci/bets.py index ef4986b50..404d03d39 100644 --- a/packages/valory/skills/market_manager_abci/bets.py +++ b/packages/valory/skills/market_manager_abci/bets.py @@ -36,9 +36,7 @@ id="marketMakerAddress", market="market", title="question", - creator="createdBy", fee="fee", - outcomeTokenMarginalPrices="outcomePrices", scaledLiquidityMeasure="liquidity", ) @@ -77,9 +75,8 @@ def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": outcome_token_amounts = [0] * len(outcomes) end_date = datetime.strptime(kwargs["endDate"], "%Y-%m-%dT%H:%M:%S.%fZ") opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) - - kwargs["createdBy"] = kwargs["createdBy"] or NULL_ADDRESS - kwargs["outcomePrices"] = eval(kwargs["outcomePrices"]) + created_by = kwargs["createdBy"] or NULL_ADDRESS + outcome_prices = eval(kwargs["outcomePrices"]) omen_to_polywrap_mapping = { omen_key: kwargs[polywrap_key] @@ -88,9 +85,11 @@ def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": return cls( collateralToken=USDC, + creator=created_by, openingTimestamp=opening_timestamp, outcomeSlotCount=len(outcomes), outcomeTokenAmounts=outcome_token_amounts, + outcomeTokenMarginalPrices=outcome_prices, outcomes=outcomes, **omen_to_polywrap_mapping, ) From 87eb59cf5020ad920a53f0f97a9e3924e6c3c4cc Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 12:49:08 +0200 Subject: [PATCH 16/20] fix: get the `creator` correctly https://github.com/valory-xyz/trader/pull/195#discussion_r1442723752 --- packages/valory/skills/market_manager_abci/bets.py | 4 ++-- .../market_manager_abci/graph_tooling/queries/polymarket.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/bets.py b/packages/valory/skills/market_manager_abci/bets.py index 404d03d39..c562a982d 100644 --- a/packages/valory/skills/market_manager_abci/bets.py +++ b/packages/valory/skills/market_manager_abci/bets.py @@ -75,7 +75,7 @@ def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": outcome_token_amounts = [0] * len(outcomes) end_date = datetime.strptime(kwargs["endDate"], "%Y-%m-%dT%H:%M:%S.%fZ") opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) - created_by = kwargs["createdBy"] or NULL_ADDRESS + submitted_by = kwargs["submitted_by"] or NULL_ADDRESS outcome_prices = eval(kwargs["outcomePrices"]) omen_to_polywrap_mapping = { @@ -85,7 +85,7 @@ def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": return cls( collateralToken=USDC, - creator=created_by, + creator=submitted_by, openingTimestamp=opening_timestamp, outcomeSlotCount=len(outcomes), outcomeTokenAmounts=outcome_token_amounts, diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py index 7a25e9a12..eab547612 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py @@ -33,7 +33,7 @@ marketMakerAddress question denominationToken - createdBy + submitted_by fee endDate outcomes From e76eca95c1606593207652ac723041ace5f17996 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 15:22:04 +0200 Subject: [PATCH 17/20] fix: ignore not-yet updated markets https://github.com/valory-xyz/trader/pull/195#discussion_r1442753829 --- .../market_manager_abci/graph_tooling/queries/polymarket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py index eab547612..e243e66ff 100644 --- a/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py +++ b/packages/valory/skills/market_manager_abci/graph_tooling/queries/polymarket.py @@ -26,7 +26,7 @@ """ { markets( - where: "active=true AND closed=false AND outcomes='[\\\"Yes\\\", \\\"No\\\"]'" + where: "active=true AND closed=false AND outcomes='[\\\"Yes\\\", \\\"No\\\"]' AND NOT market_maker_address=''" order: "start_date DESC" limit: 100 ) { From a188ba5c67b9d7a77cdbcad191b85d41b3bb882a Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 18:19:00 +0200 Subject: [PATCH 18/20] chore: add `nosec` --- packages/valory/skills/market_manager_abci/bets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/valory/skills/market_manager_abci/bets.py b/packages/valory/skills/market_manager_abci/bets.py index c562a982d..301469984 100644 --- a/packages/valory/skills/market_manager_abci/bets.py +++ b/packages/valory/skills/market_manager_abci/bets.py @@ -71,12 +71,12 @@ class Bet: @classmethod def from_gamma_subgraph(cls, **kwargs: Any) -> "Bet": """Initialize a bet's instance from gamma subgraph's attributes.""" - outcomes = eval(kwargs["outcomes"]) + outcomes = eval(kwargs["outcomes"]) # nosec outcome_token_amounts = [0] * len(outcomes) end_date = datetime.strptime(kwargs["endDate"], "%Y-%m-%dT%H:%M:%S.%fZ") opening_timestamp = int(end_date.replace(tzinfo=timezone.utc).timestamp()) submitted_by = kwargs["submitted_by"] or NULL_ADDRESS - outcome_prices = eval(kwargs["outcomePrices"]) + outcome_prices = eval(kwargs["outcomePrices"]) # nosec omen_to_polywrap_mapping = { omen_key: kwargs[polywrap_key] From fe8c69bd72553d481dce3112b1e13dfe5f727163 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 18:19:20 +0200 Subject: [PATCH 19/20] chore: ignore `gitleaks` false positives --- .gitleaksignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitleaksignore b/.gitleaksignore index 9ab5c264a..e3e6b89ad 100644 --- a/.gitleaksignore +++ b/.gitleaksignore @@ -15,3 +15,6 @@ b520b0c67a9ae55ba501e1e9a99abfc0738e8d49:packages/valory/skills/staking_abci/ski 4063acab1bf2654eeaa6fca86bfbc3f6ab57e399:packages/valory/services/trader/service.yaml:generic-api-key:9 392a14119facddbad6edd8f1d7553db08cdbf20c:packages/valory/skills/market_manager_abci/skill.yaml:generic-api-key:17 cfbec155d82abe64814af23610a4c69017d69096:packages/valory/skills/market_manager_abci/skill.yaml:generic-api-key:17 +ed30ffbaaf3c10476dc642d388985c250afaeb8d:packages/valory/skills/market_manager_abci/graph_tooling/requests.py:generic-api-key:221 +ed30ffbaaf3c10476dc642d388985c250afaeb8d:packages/valory/skills/market_manager_abci/graph_tooling/requests.py:generic-api-key:222 +d004f2345bf31b27c343eb52c1bc5a2698e838d6:packages/valory/skills/market_manager_abci/graph_tooling/requests.py:generic-api-key:221 From d698fc7218d95612a460152509980acdee099fd5 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Fri, 5 Jan 2024 18:20:27 +0200 Subject: [PATCH 20/20] chore: run generators --- packages/packages.json | 12 ++++++------ packages/valory/agents/trader/aea-config.yaml | 8 ++++---- packages/valory/services/trader/service.yaml | 2 +- .../valory/skills/decision_maker_abci/skill.yaml | 2 +- .../valory/skills/market_manager_abci/skill.yaml | 6 +++--- packages/valory/skills/trader_abci/skill.yaml | 6 +++--- .../skills/tx_settlement_multiplexer_abci/skill.yaml | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 9282d20ed..02f6656fe 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -1,13 +1,13 @@ { "dev": { - "skill/valory/market_manager_abci/0.1.0": "bafybeiahxfc7jrvp4rebgno6ujhu6j5fsg2tdjcim6z2z4ffmzppdtgyyu", - "skill/valory/decision_maker_abci/0.1.0": "bafybeibxkwnxgbnsjryuc6v46m5osy2olmqzg6s7eb436ulxfmdkk7t4ky", - "skill/valory/trader_abci/0.1.0": "bafybeihkxkzt3rmaqezljhtkeplvnvp3hb243yna2krsk74syjhyzcmlxm", + "skill/valory/market_manager_abci/0.1.0": "bafybeia7vrpts3jeldxr4osltz5ekw7p3h2ib5ossutpviplkzqvfwhjua", + "skill/valory/decision_maker_abci/0.1.0": "bafybeihxo35ycripnuwcltfy64lxhaox43av7lbcozdgw2w3wupzzpdnn4", + "skill/valory/trader_abci/0.1.0": "bafybeid6md2wq6m4nwahdvv4kfbhvl67rvpn4tokgtbjvjb4qkmzhqxgui", "contract/valory/market_maker/0.1.0": "bafybeiain372i5t6eteem36vzhwh6ppka6hc4oyrxjtyzuar6rd6bjocem", - "agent/valory/trader/0.1.0": "bafybeiaojetgp5ocx2coawzjxj6f4wk5dztkjowysqgd7dfxie7sntg7vy", - "service/valory/trader/0.1.0": "bafybeieeiiual5ei65ivgo3cyxjr5xw4a433wdwbht7ihlcwpy6emdp3iu", + "agent/valory/trader/0.1.0": "bafybeidjs3la6qd655ajn2u4lbchdi7suy5gne5rvzwgiscqrcvghz4oqy", + "service/valory/trader/0.1.0": "bafybeidkc4ww2dgcdpkoy5umbqudlz5ljufjuvhruvhil73xg3dkbj5qbq", "contract/valory/erc20/0.1.0": "bafybeiad6qbyhr3sgvclqne7tvyvqt32pcj5aq47hhkd2vmawaflhy5vna", - "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeifojwvs22tk6smk76743b5jrd3cda2dahcsimrdaf263nsiupu7cu", + "skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeibal5o2ji3rxjf5plwsexpiafv6ufnntre2pikfd5qrykff3icaoi", "contract/valory/mech/0.1.0": "bafybeiauxqogu726oeethvzux6r77zgn7sw5j2l4uigqb47zlqawblkv6e", "contract/valory/realitio/0.1.0": "bafybeic5ie4oodetj4krdogydvbfxg4qggc3matpiflocah626tpevpreq", "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 cb6343c7a..6bc03818a 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:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifojwvs22tk6smk76743b5jrd3cda2dahcsimrdaf263nsiupu7cu -- valory/market_manager_abci:0.1.0:bafybeiahxfc7jrvp4rebgno6ujhu6j5fsg2tdjcim6z2z4ffmzppdtgyyu -- valory/decision_maker_abci:0.1.0:bafybeibxkwnxgbnsjryuc6v46m5osy2olmqzg6s7eb436ulxfmdkk7t4ky -- valory/trader_abci:0.1.0:bafybeihkxkzt3rmaqezljhtkeplvnvp3hb243yna2krsk74syjhyzcmlxm +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibal5o2ji3rxjf5plwsexpiafv6ufnntre2pikfd5qrykff3icaoi +- valory/market_manager_abci:0.1.0:bafybeia7vrpts3jeldxr4osltz5ekw7p3h2ib5ossutpviplkzqvfwhjua +- valory/decision_maker_abci:0.1.0:bafybeihxo35ycripnuwcltfy64lxhaox43av7lbcozdgw2w3wupzzpdnn4 +- valory/trader_abci:0.1.0:bafybeid6md2wq6m4nwahdvv4kfbhvl67rvpn4tokgtbjvjb4qkmzhqxgui - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy default_ledger: ethereum required_ledgers: diff --git a/packages/valory/services/trader/service.yaml b/packages/valory/services/trader/service.yaml index d107d6aa4..3c7e2b7d3 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:bafybeiaojetgp5ocx2coawzjxj6f4wk5dztkjowysqgd7dfxie7sntg7vy +agent: valory/trader:0.1.0:bafybeidjs3la6qd655ajn2u4lbchdi7suy5gne5rvzwgiscqrcvghz4oqy number_of_agents: 4 deployment: {} --- diff --git a/packages/valory/skills/decision_maker_abci/skill.yaml b/packages/valory/skills/decision_maker_abci/skill.yaml index 1b76b8fe0..3e1293b5e 100644 --- a/packages/valory/skills/decision_maker_abci/skill.yaml +++ b/packages/valory/skills/decision_maker_abci/skill.yaml @@ -67,7 +67,7 @@ protocols: - valory/ipfs:0.1.0:bafybeiedxeismnx3k5ty4mvvhlqideixlhqmi5mtcki4lxqfa7uqh7p33u skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/market_manager_abci:0.1.0:bafybeiahxfc7jrvp4rebgno6ujhu6j5fsg2tdjcim6z2z4ffmzppdtgyyu +- valory/market_manager_abci:0.1.0:bafybeia7vrpts3jeldxr4osltz5ekw7p3h2ib5ossutpviplkzqvfwhjua - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa behaviours: main: diff --git a/packages/valory/skills/market_manager_abci/skill.yaml b/packages/valory/skills/market_manager_abci/skill.yaml index 13932796e..d0fe8144b 100644 --- a/packages/valory/skills/market_manager_abci/skill.yaml +++ b/packages/valory/skills/market_manager_abci/skill.yaml @@ -9,7 +9,7 @@ fingerprint: README.md: bafybeie6miwn67uin3bphukmf7qgiifh4xtm42i5v3nuyqxzxtehxsqvcq __init__.py: bafybeigrtedqzlq5mtql2ssjsdriw76ml3666m4e2c3fay6vmyzofl6v6e behaviours.py: bafybeiahcgt4r3q33lcj46bcfojbozntacggnn7fmftc3xa5czepkvnfci - bets.py: bafybeiav3y7p2lnrjciyno35f32l672skatzk2qsak246w7pi4wg5ssgau + bets.py: bafybeifylnqxusdcamdbrehl7myt72ux6e6iqbrkri4adbeoywz2jtlgna dialogues.py: bafybeiebofyykseqp3fmif36cqmmyf3k7d2zbocpl6t6wnlpv4szghrxbm fsm_specification.yaml: bafybeic5cvwfbiu5pywyp3h5s2elvu7jqdrcwayay7o3v3ow47vu2jw53q graph_tooling/__init__.py: bafybeigzo7nhbzafyq3fuhrlewksjvmzttiuk4vonrggtjtph4rw4ncpk4 @@ -17,10 +17,10 @@ fingerprint: graph_tooling/queries/conditional_tokens.py: bafybeic6ohkdp4rvkcfglieksv6gbzm4qocpgdjaz4sroutl37sxijthji graph_tooling/queries/network.py: bafybeigeq72ys2nrjqspj2uacaudrgljrne5a3o5jvzsktldxdq6m2xmeu graph_tooling/queries/omen.py: bafybeiesgavgoio6zeovdyvzeezz5qoosdgioktoen5ckrgyxpr4u3m3nu - graph_tooling/queries/polymarket.py: bafybeigpwlnykaikvqkaog3whw26kybl5uuiy7perk6px7tq5pczxo5yo4 + graph_tooling/queries/polymarket.py: bafybeifksst3c54bjxedroe2gxtr7mga5f7ftuolj7jpdbbabn6m6xr3yy graph_tooling/queries/realitio.py: bafybeiftewjwk5fi6uqrhmalweun47voau2qkxi7hg3faxcmyy3va44zma graph_tooling/queries/trades.py: bafybeigu6c25kf3mrlvmwjeskgagswdjnnxsygpriygmip44us4xvuf7ji - graph_tooling/requests.py: bafybeigqbj5a6w5kwi4yqdsvhakon7bzvrj6btozx4efyoqwzuaplfiw5e + graph_tooling/requests.py: bafybeidhmj3ehool5bliavzjvnbsfvngcss5u2jsttngkpqgocwd4e2mai graph_tooling/utils.py: bafybeig5hxhnqgyfn5ym3poc5nziqwpeozqbd6wa4s6c2hjn6iyedg3t3y handlers.py: bafybeihot2i2yvfkz2gcowvt66wdu6tkjbmv7hsmc4jzt4reqeaiuphbtu models.py: bafybeid4u7za24nqa23bqpabfczwgnbwy552zx4htnwc5qdh3ax3abl67i diff --git a/packages/valory/skills/trader_abci/skill.yaml b/packages/valory/skills/trader_abci/skill.yaml index 86557190b..f62b6157e 100644 --- a/packages/valory/skills/trader_abci/skill.yaml +++ b/packages/valory/skills/trader_abci/skill.yaml @@ -24,9 +24,9 @@ skills: - valory/reset_pause_abci:0.1.0:bafybeibnwjcjx4lluf4cwb6es5peelu3gm7vrzlieygrzpbjlubxpvbvzy - valory/transaction_settlement_abci:0.1.0:bafybeifpnkwgwpzz6uwrvfgurm26allr6shjfbp7bfbrxwy64sw3nf3fsa - valory/termination_abci:0.1.0:bafybeifdtxgldw33kwvsavcituzewwbr6iqfcsgk5qouqfhpwdrivyyyom -- valory/market_manager_abci:0.1.0:bafybeiahxfc7jrvp4rebgno6ujhu6j5fsg2tdjcim6z2z4ffmzppdtgyyu -- valory/decision_maker_abci:0.1.0:bafybeibxkwnxgbnsjryuc6v46m5osy2olmqzg6s7eb436ulxfmdkk7t4ky -- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeifojwvs22tk6smk76743b5jrd3cda2dahcsimrdaf263nsiupu7cu +- valory/market_manager_abci:0.1.0:bafybeia7vrpts3jeldxr4osltz5ekw7p3h2ib5ossutpviplkzqvfwhjua +- valory/decision_maker_abci:0.1.0:bafybeihxo35ycripnuwcltfy64lxhaox43av7lbcozdgw2w3wupzzpdnn4 +- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeibal5o2ji3rxjf5plwsexpiafv6ufnntre2pikfd5qrykff3icaoi - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy 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 c6eedcbde..67ad96855 100644 --- a/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml +++ b/packages/valory/skills/tx_settlement_multiplexer_abci/skill.yaml @@ -21,7 +21,7 @@ protocols: - valory/ledger_api:1.0.0:bafybeige5agrztgzfevyglf7mb4o7pzfttmq4f6zi765y4g2zvftbyowru skills: - valory/abstract_round_abci:0.1.0:bafybeicrzndcdbue34yxwwb4hmmdhgzw4owcdcdag3ifj6thpx5wie3dp4 -- valory/decision_maker_abci:0.1.0:bafybeibxkwnxgbnsjryuc6v46m5osy2olmqzg6s7eb436ulxfmdkk7t4ky +- valory/decision_maker_abci:0.1.0:bafybeihxo35ycripnuwcltfy64lxhaox43av7lbcozdgw2w3wupzzpdnn4 - valory/staking_abci:0.1.0:bafybeiccopehegiiwxzghrttdhuxtnjp7zvuiclx5zchbtvqpy45rrvdxy behaviours: main: