### Python Method Docstring Example Source: https://github.com/valory-xyz/trader/blob/main/CONTRIBUTING.md Illustrates a comprehensive docstring for a Python method, detailing its purpose, example usage, parameters, return type, and potential exceptions. This example emphasizes the importance of informative documentation for complex logic, beyond just a single line. ```python def some_method(some_arg: Type) -> ReturnType: """ This method does something very complex. example: >> a = Type("value") >> some_method(a) output :param some_arg: describe argument. :return: value of ReturnType optional - types of exceptions it might raise """ ``` -------------------------------- ### Set Up Python Development Environment with Poetry Source: https://github.com/valory-xyz/trader/blob/main/README.md Installs project dependencies using Poetry and activates the isolated Python virtual environment, preparing the development workspace for the Trader service. ```Shell poetry install && poetry shell ``` -------------------------------- ### Clone Trader Service Repository Source: https://github.com/valory-xyz/trader/blob/main/README.md Clones the valory-xyz/trader repository from GitHub to your local machine, providing the source code for the Trader service. ```Shell git clone https://github.com/valory-xyz/trader.git ``` -------------------------------- ### Synchronize Open Autonomy Packages Source: https://github.com/valory-xyz/trader/blob/main/README.md Pulls and updates all necessary Open Autonomy packages required to run the Trader service, ensuring all dependencies are met and up-to-date. ```Shell autonomy packages sync --update-packages ``` -------------------------------- ### Deploy and Run Valory Trader Service Source: https://github.com/valory-xyz/trader/blob/main/README.md Deploys the Valory Trader service with a single agent and then executes it. This involves building the deployment artifacts and then running the service from the generated build directory. ```bash autonomy deploy build --n 1 -ltm build_dir=$(ls -d abci_build_????/ 2>/dev/null || echo "abci_build") autonomy deploy run --build-dir $build_dir ``` -------------------------------- ### Build Trader Service Docker Image Source: https://github.com/valory-xyz/trader/blob/main/README.md Builds the necessary Docker image for the Valory Trader service, which is a prerequisite for containerized deployment. ```bash autonomy build-image ``` -------------------------------- ### Trader Service Configuration Variables Reference Source: https://github.com/valory-xyz/trader/blob/main/README.md Detailed descriptions of the environment variables used to configure the Valory Trader service, outlining their purpose, expected values, and any specific usage notes. ```APIDOC RPC_0: Description: RPC endpoint for the agent (e.g., from getblock.io). CHAIN_ID: Description: Identifier of the blockchain network where the service is running (e.g., Gnosis=100). ALL_PARTICIPANTS: Description: A JSON array of all agent addresses participating in the service. SAFE_CONTRACT_ADDRESS: Description: The address of the agents' multisig wallet. OMEN_CREATORS: Description: A JSON array of market creator addresses that the service will monitor for placing bets on Omen. BET_AMOUNT_PER_THRESHOLD_X: Description: The amount (in wei) to bet when the AI Mech's prediction confidence for a market surpasses a threshold of X%. Amounts vary based on confidence (e.g., 0.03 xDAI for 60% confidence to 0.1 xDAI for 100% confidence). BET_THRESHOLD: Description: A threshold (in wei) for placing a bet. A bet is only placed if `potential_net_profit - BET_THRESHOLD` is non-negative. This value should account for transaction fees. PROMPT_TEMPLATE: Description: The prompt string used with the prediction AI Mech. It must be a single line and include the placeholders `@{question}`, `@{yes}`, and `@{no}`. ``` -------------------------------- ### Fetch Valory Trader Service Source: https://github.com/valory-xyz/trader/blob/main/README.md Fetches the Valory Trader service locally using the `autonomy` CLI tool and then changes the current directory to the service's root. ```bash autonomy fetch --local --service valory/trader && cd trader ``` -------------------------------- ### Initialize and Configure Open Autonomy Framework Source: https://github.com/valory-xyz/trader/blob/main/README.md Initializes the Open Autonomy framework, setting up the author, enabling remote package fetching, and configuring the IPFS node for package synchronization. This is a prerequisite for running Autonolas agents. ```Shell autonomy init --reset --author valory --remote --ipfs --ipfs-node "/dns/registry.autonolas.tech/tcp/443/https" ``` -------------------------------- ### Create Agent Gnosis Keypair File Source: https://github.com/valory-xyz/trader/blob/main/README.md Generates a `keys.json` file containing the agent's Gnosis address and private key. This file is essential for the agent to sign transactions and interact with the blockchain. ```Shell cat > keys.json << EOF [ { "address": "YOUR_AGENT_ADDRESS", "private_key": "YOUR_AGENT_PRIVATE_KEY" } ] EOF ``` -------------------------------- ### Copy keys.json to Service Directory Source: https://github.com/valory-xyz/trader/blob/main/README.md Copies the `keys.json` file, which contains the agent's private keys, into the service's working directory. This file is essential for the agent's operation. ```bash cp path/to/keys.json . ``` -------------------------------- ### Contribution Workflow Commands for Code Quality and Checks Source: https://github.com/valory-xyz/trader/blob/main/CONTRIBUTING.md A collection of command-line instructions to be executed at various stages of the contribution workflow, including pre-pull request checks, conditional builds based on file changes, and post-commit validations, ensuring adherence to project standards and quality. ```bash tomte format-code tomte check-code make security ``` ```bash make abci-docstrings ``` ```bash make generators make common-checks-1 ``` ```bash make copyright ``` ```bash make common-checks-2 ``` ```bash tomte check-spelling ``` -------------------------------- ### Configure Multi-Agent Environment Variables for Valory Trader Source: https://github.com/valory-xyz/trader/blob/main/README.md These environment variables are required to run the Valory Trader service with multiple agents, specifying individual RPC endpoints and a collective list of participant addresses. Each RPC_i corresponds to the RPC endpoint for AGENT_ADDRESS_i. ```bash export RPC_0=INSERT_YOUR_RPC export RPC_1=INSERT_YOUR_RPC export RPC_2=INSERT_YOUR_RPC export RPC_3=INSERT_YOUR_RPC export ALL_PARTICIPANTS='["AGENT_ADDRESS_0,AGENT_ADDRESS_1,AGENT_ADDRESS_2,AGENT_ADDRESS_3"]' ``` -------------------------------- ### Configure Trader Service Environment Variables Source: https://github.com/valory-xyz/trader/blob/main/README.md Sets up essential environment variables for the Valory trading agent. These variables control the agent's connection, participants, safe contract, Omen market creators, betting strategy based on confidence thresholds, and the prompt template for the AI Mech. Users must replace placeholders like `YOUR_AGENT_ADDRESS` and `YOUR_SAFE_ADDRESS` with their specific values. ```bash export RPC_0=INSERT_YOUR_RPC export CHAIN_ID=100 export ALL_PARTICIPANTS='["YOUR_AGENT_ADDRESS"]' export SAFE_CONTRACT_ADDRESS="YOUR_SAFE_ADDRESS" export OMEN_CREATORS='["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]' export BET_AMOUNT_PER_THRESHOLD_000=0 export BET_AMOUNT_PER_THRESHOLD_010=0 export BET_AMOUNT_PER_THRESHOLD_020=0 export BET_AMOUNT_PER_THRESHOLD_030=0 export BET_AMOUNT_PER_THRESHOLD_040=0 export BET_AMOUNT_PER_THRESHOLD_050=0 export BET_AMOUNT_PER_THRESHOLD_060=30000000000000000 export BET_AMOUNT_PER_THRESHOLD_070=40000000000000000 export BET_AMOUNT_PER_THRESHOLD_080=60000000000000000 export BET_AMOUNT_PER_THRESHOLD_090=80000000000000000 export BET_AMOUNT_PER_THRESHOLD_100=100000000000000000 export BET_THRESHOLD=5000000000000000 export PROMPT_TEMPLATE='With the given question "@{question}" and the `yes` option represented by `@{yes}` and the `no` option represented by `@{no}`, what are the respective probabilities of `p_yes` and `p_no` occurring?' ``` -------------------------------- ### Define robots.txt directives for web crawlers Source: https://github.com/valory-xyz/trader/blob/main/packages/valory/skills/trader_abci/predict-ui-build/robots.txt This snippet defines directives for web crawlers, allowing full access to all paths on the website. The `User-agent: *` directive applies the rules to all crawlers, and `Disallow:` with no path indicates that no paths are disallowed. ```robots.txt User-agent: * Disallow: ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.