❓Conditional Node
Last updated
Last updated
The Conditional Node is a crucial component in the MindTrade platform, enabling dynamic decision-making within the trading bot's workflow. It evaluates specific conditions or criteria and directs the flow of execution based on the results of this evaluation.
Evaluating Conditions: A Conditional Node checks certain conditions and determines the path of execution based on whether these conditions are met or not.
Branching Logic: Depending on the outcome of the condition evaluation, the node can direct the execution towards different subsequent nodes, effectively allowing the bot to respond adaptively to various scenarios.
Let's begin by adding a Conditional Node to the canvas. Initially, its condition will be empty, so you'll see an "Add Operand" button. Let's click on it!
Then, the input selection panel will appear. Here, like with any other node, you can choose the input source. You have the options to take the input from another node's output, enter a handwritten (static) value, or select from a secret.
We selected "Node" because we want to use the output from the "Get Price" node to check if the price of WETH is greater than a specific amount.
Then, select the "greater" operator to check if the output from the "Get Price" node is greater than a specified amount.
In the last box, enter the static value that you want to compare against, specifying the amount that the price should be greater than.
Done! As you can see, the condition set within the Conditional Node now states "if the price of WETH is more than 4000."
What if we want to say "if the price of WETH is more than 4000 AND the ETH balance of a wallet is more than 10"? Let's add a "Get EVM Coin Balance" node first!
Then click on "+ Add condition" to add a new condition.
An "AND/OR" button will appear, allowing you to specify "if this AND/OR that."
Then, as before, select the output of the "Get EVM Coin Balance" node and check if its output is greater than 10.
Done! You are now able to check "if the price of WETH is more than 4000 and the ETH balance of a certain wallet is more than 10"