Skip to content

packages.valory.skills.price_estimation_abci.behaviours

This module contains the behaviours for the 'abci' skill.

PriceEstimationBaseBehaviour Objects

class PriceEstimationBaseBehaviour(BaseBehaviour,  ABC)

Base behaviour for the common apps' skill.

synchronized_data

@property
def synchronized_data() -> SynchronizedData

Return the synchronized data.

params

@property
def params() -> Params

Return the params.

ObserveBehaviour Objects

class ObserveBehaviour(PriceEstimationBaseBehaviour)

Observe price estimate.

async_act

def async_act() -> Generator

Do the action.

Steps: - Ask the configured API the price of a currency. - If the request fails, retry until max retries are exceeded. - Send an observation transaction and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

clean_up

def clean_up() -> None

Clean up the resources due to a 'stop' event.

It can be optionally implemented by the concrete classes.

EstimateBehaviour Objects

class EstimateBehaviour(PriceEstimationBaseBehaviour)

Estimate price.

async_act

def async_act() -> Generator

Do the action.

Steps: - Run the script to compute the estimate starting from the shared observations. - Build an estimate transaction and send the transaction and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

pack_for_server

def pack_for_server(participants: Sequence[str], decimals: int, period_count: int, estimate: float, observations: Dict[str, float], data_source: str, unit: str, **_: Dict[str, str], ,) -> bytes

Package server data for signing

TransactionHashBehaviour Objects

class TransactionHashBehaviour(PriceEstimationBaseBehaviour)

Share the transaction hash for the signature round.

async_act

def async_act() -> Generator

Do the action.

Steps: - Request the transaction hash for the safe transaction. This is the hash that needs to be signed by a threshold of agents. - Send the transaction hash as a transaction and wait for it to be mined. - Wait until ABCI application transitions to the next round. - Go to the next behaviour (set done event).

send_to_server

def send_to_server() -> Generator

Send data to server.

We send current period data of the agents and the previous cycle's on-chain settlement tx hash. The current cycle's tx hash is not available at this stage yet, and the first iteration will contain no tx hash since there has not been on-chain transaction settlement yet.

:yield: the http response

ObserverRoundBehaviour Objects

class ObserverRoundBehaviour(AbstractRoundBehaviour)

This behaviour manages the consensus stages for the observer behaviour.

Back to top