-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from valory-xyz/feat/chain
Create trader abci
- Loading branch information
Showing
15 changed files
with
584 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Trader abci | ||
|
||
## Description | ||
|
||
This module contains the trader chained skill for an AEA. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the trader chained skill for an AEA.""" | ||
|
||
from aea.configurations.base import PublicId | ||
|
||
|
||
PUBLIC_ID = PublicId.from_str("valory/trader_abci:0.1.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# -*- 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the behaviours for the trader skill.""" | ||
|
||
from typing import Set, Type | ||
|
||
from packages.valory.skills.abstract_round_abci.behaviours import ( | ||
AbstractRoundBehaviour, | ||
BaseBehaviour, | ||
) | ||
from packages.valory.skills.decision_maker_abci.behaviours.round_behaviour import ( | ||
AgentDecisionMakerRoundBehaviour, | ||
) | ||
from packages.valory.skills.market_manager_abci.behaviours import ( | ||
MarketManagerRoundBehaviour, | ||
) | ||
from packages.valory.skills.registration_abci.behaviours import ( | ||
AgentRegistrationRoundBehaviour, | ||
RegistrationStartupBehaviour, | ||
) | ||
from packages.valory.skills.reset_pause_abci.behaviours import ( | ||
ResetPauseABCIConsensusBehaviour, | ||
) | ||
from packages.valory.skills.termination_abci.behaviours import ( | ||
BackgroundBehaviour, | ||
TerminationAbciBehaviours, | ||
) | ||
from packages.valory.skills.trader_abci.composition import TraderAbciApp | ||
|
||
|
||
class TraderConsensusBehaviour(AbstractRoundBehaviour): | ||
"""This behaviour manages the consensus stages for the trader.""" | ||
|
||
initial_behaviour_cls = RegistrationStartupBehaviour | ||
abci_app_cls = TraderAbciApp | ||
|
||
behaviours: Set[Type[BaseBehaviour]] = { | ||
*AgentRegistrationRoundBehaviour.behaviours, | ||
*AgentDecisionMakerRoundBehaviour.behaviours, | ||
*MarketManagerRoundBehaviour.behaviours, | ||
*ResetPauseABCIConsensusBehaviour.behaviours, | ||
*TerminationAbciBehaviours.behaviours, | ||
} | ||
background_behaviour_cls = BackgroundBehaviour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# -*- 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the trader ABCI application.""" | ||
|
||
from packages.valory.skills.abstract_round_abci.abci_app_chain import ( | ||
AbciAppTransitionMapping, | ||
chain, | ||
) | ||
from packages.valory.skills.decision_maker_abci.rounds import DecisionMakerAbciApp | ||
from packages.valory.skills.decision_maker_abci.states.final_states import ( | ||
FinishedDecisionMakerRound, | ||
FinishedWithoutDecisionRound, | ||
) | ||
from packages.valory.skills.decision_maker_abci.states.sampling import SamplingRound | ||
from packages.valory.skills.market_manager_abci.rounds import ( | ||
FailedMarketManagerRound, | ||
FinishedMarketManagerRound, | ||
MarketManagerAbciApp, | ||
UpdateBetsRound, | ||
) | ||
from packages.valory.skills.registration_abci.rounds import ( | ||
AgentRegistrationAbciApp, | ||
FinishedRegistrationRound, | ||
RegistrationRound, | ||
) | ||
from packages.valory.skills.reset_pause_abci.rounds import ( | ||
FinishedResetAndPauseErrorRound, | ||
FinishedResetAndPauseRound, | ||
ResetAndPauseRound, | ||
ResetPauseAbciApp, | ||
) | ||
from packages.valory.skills.termination_abci.rounds import BackgroundRound | ||
from packages.valory.skills.termination_abci.rounds import Event as TerminationEvent | ||
from packages.valory.skills.termination_abci.rounds import TerminationAbciApp | ||
|
||
|
||
abci_app_transition_mapping: AbciAppTransitionMapping = { | ||
FinishedRegistrationRound: UpdateBetsRound, | ||
FinishedMarketManagerRound: SamplingRound, | ||
FailedMarketManagerRound: ResetAndPauseRound, | ||
FinishedDecisionMakerRound: ResetAndPauseRound, | ||
FinishedWithoutDecisionRound: ResetAndPauseRound, | ||
FinishedResetAndPauseRound: UpdateBetsRound, | ||
FinishedResetAndPauseErrorRound: RegistrationRound, | ||
} | ||
|
||
TraderAbciApp = chain( | ||
( | ||
AgentRegistrationAbciApp, | ||
DecisionMakerAbciApp, | ||
MarketManagerAbciApp, | ||
ResetPauseAbciApp, | ||
), | ||
abci_app_transition_mapping, | ||
).add_termination( | ||
background_round_cls=BackgroundRound, | ||
termination_event=TerminationEvent.TERMINATE, | ||
termination_abci_app=TerminationAbciApp, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# -*- 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
"""This module contains the classes required for dialogue management.""" | ||
|
||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
AbciDialogue as BaseAbciDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
AbciDialogues as BaseAbciDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
ContractApiDialogue as BaseContractApiDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
ContractApiDialogues as BaseContractApiDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
HttpDialogue as BaseHttpDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
HttpDialogues as BaseHttpDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
IpfsDialogue as BaseIpfsDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
IpfsDialogues as BaseIpfsDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
LedgerApiDialogue as BaseLedgerApiDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
LedgerApiDialogues as BaseLedgerApiDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
SigningDialogue as BaseSigningDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
SigningDialogues as BaseSigningDialogues, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
TendermintDialogue as BaseTendermintDialogue, | ||
) | ||
from packages.valory.skills.abstract_round_abci.dialogues import ( | ||
TendermintDialogues as BaseTendermintDialogues, | ||
) | ||
|
||
|
||
AbciDialogue = BaseAbciDialogue | ||
AbciDialogues = BaseAbciDialogues | ||
|
||
|
||
HttpDialogue = BaseHttpDialogue | ||
HttpDialogues = BaseHttpDialogues | ||
|
||
|
||
SigningDialogue = BaseSigningDialogue | ||
SigningDialogues = BaseSigningDialogues | ||
|
||
|
||
LedgerApiDialogue = BaseLedgerApiDialogue | ||
LedgerApiDialogues = BaseLedgerApiDialogues | ||
|
||
|
||
ContractApiDialogue = BaseContractApiDialogue | ||
ContractApiDialogues = BaseContractApiDialogues | ||
|
||
TendermintDialogue = BaseTendermintDialogue | ||
TendermintDialogues = BaseTendermintDialogues | ||
|
||
|
||
IpfsDialogue = BaseIpfsDialogue | ||
IpfsDialogues = BaseIpfsDialogues |
Oops, something went wrong.