o1 Exchange Automated Buy-Sell Loop
Automated buy-sell loop trading strategy on O1 Exchange with configurable delays and loop counts
O1ExchangeTradingAutomationBuy-SellLoop
Who is this for?
This workflow is designed for cryptocurrency traders who want to automate buy-sell trading loops on o1Exchange. It's ideal for traders who want to execute repeated buy and sell cycles with configurable delays and intervals without manual intervention.
What problem is this workflow solving? / Use case
Manually executing repeated buy-sell cycles on O1 Exchange is time-consuming and requires constant monitoring. This workflow automates the entire process by:
- Automatically buying tokens with ETH
- Waiting for a specified delay period
- Selling the tokens back
- Repeating this cycle multiple times with configurable intervals
This is useful for trading strategies that require repeated execution, volume generation, or automated trading patterns.
What this workflow does
-
Buy Phase: Places a buy order on O1 Exchange for the specified token using ETH
- The buy amount is specified in ETH (e.g., 0.1 ETH)
- Uses configurable slippage protection to ensure trades execute within acceptable price ranges
- Signs all required transactions including Permit2 approvals if needed
-
Wait Period: Waits for the specified delay period (in seconds) before proceeding to sell
- This allows time for the buy order to settle or for market conditions to change
-
Sell Phase: Automatically sells the tokens that were purchased
- Checks the token balance first to ensure there are tokens to sell
- If no balance is found, skips the sell phase for that loop
- Sells the entire token balance that was acquired
-
Loop Execution: Repeats the buy-sell cycle for the specified number of loops
- Each loop waits for the configured interval before starting the next cycle
- Continues even if errors occur, attempting all configured loops
When it runs / stops
- Starts: Immediately when the workflow is triggered
- Stops: After completing all configured loops, or if a critical error prevents continuation
- Execution: Runs continuously until all loops are completed, with automatic delays between cycles
Setup
- Token Contract Address: Enter the contract address of the token you want to trade (on Base network)
- Buy Amount (ETH): Set how much ETH you want to spend per buy order (e.g., "0.1" means 0.1 ETH)
- Sell Delay (seconds): Set how long to wait after buying before selling (default: 10 seconds)
- A shorter delay means faster cycles but less time for orders to settle
- A longer delay gives more time between buy and sell but extends the total cycle time
- Loop Count: Set how many buy-sell cycles to execute (default: 1)
- Set to "1" for a single buy-sell cycle
- Set to a higher number (e.g., "5") to repeat the cycle multiple times
- Loop Interval (seconds): Set how long to wait between completing one loop and starting the next (default: 5 seconds)
- This controls the spacing between complete cycles
- Shorter intervals mean more frequent trading but higher gas costs
- O1 Exchange credentials: Connect your O1 Exchange API key
- Signer Address: Enter the wallet address that will sign transactions
- Slippage (basis points): Set the maximum acceptable price slippage (default: 100, which means 1%)
- Lower values (e.g., 50 = 0.5%) mean stricter price limits but may cause trades to fail
- Higher values (e.g., 200 = 2%) allow more price movement but may result in less favorable execution
Important Notes:
- This workflow requires interactive wallet signing for each transaction
- You'll need to approve transactions in your wallet when prompted
- The workflow runs on Base network (network ID: 8453)
- Ensure your wallet has sufficient ETH for gas fees and the buy amount
Key Features
- Automated Execution: Completely automates the buy-sell cycle without manual intervention
- Configurable Delays: Control timing between buy and sell, and between loop cycles
- Slippage Protection: Built-in slippage protection to ensure trades execute within acceptable price ranges
- Error Resilience: Continues to next loop even if errors occur in previous cycles
- Balance Checking: Automatically checks token balance before selling to avoid unnecessary transactions
- Interactive Signing: Uses secure wallet signing for all transactions
Nodes in Use
- O1 Exchange - Build Unsigned Order Transactions: Creates unsigned buy or sell order transactions for O1 Exchange
- O1 Exchange - Build Transaction Data with Permit2 Signature: Prepares transaction data with Permit2 approval signatures
- O1 Exchange - Submit Signed Order Transactions: Submits signed order transactions to O1 Exchange
- ChainKit - Get Token Balance: Retrieves the current token balance for a wallet address on Base network
- Human in the Loop - Await Sign Typed Data: Prompts for EIP-712 signature approval (for Permit2 approvals)
- Human in the Loop - Await Sign Transaction: Prompts for transaction signature approval before submission
Reference