# Limit Orders

Overview

GRODT Trading Bot's limit order system enables users to set up conditional trades that will execute automatically when specific price conditions are met. This feature allows traders to enter or exit positions at their preferred price points without the need to constantly monitor the market.Key Features

* **Buy Limit Orders**: Automatically purchase tokens when the price falls to a specified target
* **Sell Limit Orders**: Automatically sell tokens when the price rises to a specified target
* **Custom Expiry Settings**: Set how long orders remain active (from minutes to days)
* **Order Management**: View, edit, and cancel limit orders at any time
* **Real-time Price Monitoring**: Continuous monitoring of token prices
* **Automatic Execution**: Orders execute without user intervention when conditions are met
* **Notifications**: Receive alerts about order execution, expiry, or issues

#### How to Use Limit Orders <a href="#how-to-use-limit-orders" id="how-to-use-limit-orders"></a>

**Creating a Limit Order**

* Start by selecting a token to trade (either from your portfolio or by entering a token address)
* Choose "Limit" mode instead of "Swap" mode on the trade screen
* For buy orders: set the amount of SOL you want to spend
* For sell orders: set the percentage of your token holdings to sell
* Set your target price (trigger price)
* Set the expiry time for your order
* Set your slippage tolerance

1. Review and confirm the order

**Limit Order Interface Details**

**Buy Limit Order Interface**

When creating a buy limit order, the interface displays:

**Token Information**

* **Token Balance**: Shows your current SOL balance (e.g., "Balance: 0.005 SOL ($1.03)")
* **Current Price**: Real-time token price with liquidity and market cap data
* **Price Details**: Current price, liquidity (LIQ), market cap (MC)
* **Renounced Status**: ✅ indicator if token ownership is renounced
* **Token Contract**: Shareable token address with Reflink option

**Buy Amount Configuration**

* **You Buy**: Shows the amount and value of tokens you're purchasing
* **Amount Display**: SOL amount and equivalent token quantity (e.g., "0.001 SOL ($0.23) = 10.94K Bonk ($0.23)")
* **Price Impact**: Displays the market impact of your trade (e.g., "Price Impact: 0.00%")

**SOL Amount Selection**

* **Preset SOL Amounts**: Quick selection buttons for common buy amounts
  * **0.5 SOL**: Buy with 0.5 SOL
  * **1 SOL**: Buy with 1 SOL
  * **3 SOL**: Buy with 3 SOL
  * **5 SOL**: Buy with 5 SOL
  * **10 SOL**: Buy with 10 SOL
* **Custom Amount**: ✅ **0.001 SOL** 🖊️ - Custom SOL amount input
* **Active Selection**: ✅ Green checkmark shows currently selected amount

**Sell Limit Order Interface**

When creating a sell limit order, the interface displays:

**Token Information**

* **Token Balance**: Shows your current token holdings (e.g., "Balance: 10794.919140 Bonk ($0.00)")
* **Current Price**: Real-time token price with liquidity and market cap data
* **Price Details**: Current price, liquidity (LIQ), market cap (MC)
* **Renounced Status**: ✅ indicator if token ownership is renounced
* **Token Contract**: Shareable token address with Reflink option

**Performance Metrics**

* **Average Entry Price & MC**: Shows your average buy price and market cap at entry
* **PnL USD**: Profit/Loss in USD with percentage change (e.g., "-$0.01% (-$0.00)")
* **PnL SOL**: Profit/Loss in SOL with percentage and amount (e.g., "-1.56% (0.000016 SOL)")
* **Color Coding**: 🟥 Red indicates losses, 🟢 Green indicates profits

**Sell Amount Configuration**

* **You Sell**: Shows the amount and value of tokens you're selling
* **Amount Display**: Token quantity and equivalent SOL value (e.g., "5.40K Bonk ($0.11) = 0.0005 SOL ($0.11)")
* **Price Impact**: Displays the market impact of your trade (e.g., "Price Impact: 0.00%")

**Prize Pool Information**

* **Entry Rule**: Shows prize pool participation requirements (e.g., "$100 trade = 1 entry")
* **Current Entry Count**: Displays "This trade entry: 0" indicating entries earned from this trade
* **Prize Pool Integration**: Limit orders can contribute to prize pool entries when executed

**Order Type Controls**

* **Swap/Limit Selection**: Choose between instant swap or limit order execution
* **Mode Indicators**: ✅ checkmarks show currently selected options
* **Active Selection**: Green checkmarks indicate the active trading mode

**Sell Amount Selection**

* **50% Button**: ✅ Sell half of your token holdings
* **100% Button**: Sell all of your token holdings
* **X% Button** 🖊️: Custom percentage input for precise control
* **Quick Selection**: Preset buttons for common sell percentages
* **Active Indicator**: ✅ Green checkmark shows currently selected percentage

**Slippage Configuration**

* **15% Slippage**: ✅ Preset slippage tolerance for volatile markets
* **X Slippage** 🖊️: Custom slippage input for precise control
* **Slippage Protection**: Prevents trades from executing with unfavorable price movements
* **Active Setting**: ✅ Green checkmark indicates currently selected slippage tolerance

**Price Trigger Settings**

* **Price Button**: ✅ Enable price-based trigger for limit orders
* **Trigger Price Input**: Set the exact price at which the order should execute (e.g., "Trigger Price: $\_\_\_")
* **Price Monitoring**: Order will execute automatically when market price reaches trigger price
* **Precision Control**: Enter specific price targets for optimal entry/exit points

**Trigger Price Input Options**

When setting your trigger price, you have multiple format options:

* **Percentage Change**: Use % change from current price
  * `-5%` = Trigger when price drops 5% from current price
  * `5%` = Trigger when price rises 5% from current price
* **Specific Price**: Enter exact token price
  * `$0.00001` = Trigger when token reaches this exact price
* **Market Cap**: Use market cap values
  * `5.5M mc` = Trigger when market cap reaches 5.5 million
  * `15000 mcap` = Trigger when market cap reaches 15,000
* **Flexible Input**: System accepts various formats for user convenience

**Order Expiry Controls**

* **Expiry Setting**: Configure how long the order remains active (e.g., "Expiry: 1 day")
* **Time Options**: Choose from preset durations or set custom expiry times
* **Auto-Cancellation**: Orders automatically cancel when expiry time is reached
* **Flexible Duration**: Set expiry from minutes to days based on trading strategy

**Expiry Time Input Options**

When setting your order expiry time, use these time unit formats:

* **Seconds**: Use `s` suffix
  * `30s` = Order expires in 30 seconds
  * `120s` = Order expires in 2 minutes (120 seconds)
* **Minutes**: Use `m` suffix
  * `30m` = Order expires in 30 minutes
  * `90m` = Order expires in 1.5 hours
* **Hours**: Use `h` suffix
  * `2h` = Order expires in 2 hours
  * `24h` = Order expires in 1 day
* **Days**: Use `d` suffix
  * `1d` = Order expires in 1 day
  * `7d` = Order expires in 1 week
* **Format Examples**: `30m`, `2h`, `1d`, `120s`

**Order Creation**

* **CREATE ORDER Button**: Final step to submit your configured limit order
* **Order Validation**: System validates all parameters before creation
* **Confirmation**: Order is saved and begins monitoring for trigger conditions
* **Active Status**: Successfully created orders appear in your limit orders list

**Order Confirmation Screen**

After successfully creating a limit order, you'll see a confirmation screen displaying:

**Order Details**

* **Order Status**: ✅ "Limit Order Placed" confirmation
* **Trigger Price**: Shows your set trigger price with percentage change (e.g., "+1% (≈ $0.00002079)")
* **Token Information**: Current price, liquidity, and market cap data
* **Order Type**: Displays "SELL" with token symbol and contract address

**Token Chart Integration**

* **DEXScreener Chart**: Real-time price chart embedded in confirmation
* **Market Data**: Current MCAP, 24H volume, and liquidity information
* **Visual Reference**: Chart shows current price action and market trends
* **Token Branding**: Displays token logo and "More than ordinary BONK" tagline

**Navigation Options**

* **← Back**: Return to previous screen
* **View Limit Orders**: Access your active limit orders list
* **Order Management**: Monitor and manage your placed orders

**Managing Limit Orders**

Access your limit orders by:

* Typing `/limitorders` command
* Navigating to the "Limit Orders" option from the main menu

From the limit orders screen, you can:

* View all active orders
* Search for orders by token
* View order details (token, amount, trigger price, expiry time)
* Edit order parameters (amount, trigger price, slippage, expiry)
* Cancel individual orders or all orders at once

#### Behind the Scenes <a href="#behind-the-scenes" id="behind-the-scenes"></a>

**Order Lifecycle**

* **Creation**: Order is saved to the database with status "active"
* **Monitoring**: Prices for tokens with active orders are checked regularly
* **Execution**: When price conditions are met, the order is executed via Jupiter swap
* **Completion**: Order status is updated to "executed", "expired", or "failed"

1. **Notification**: User is notified about the order outcome

**Technical Implementation**

The limit order system consists of several components:

* **Order Database**: MongoDB schema for storing order details
* **Price Monitoring Worker**: Background worker that checks prices regularly
* **Order Execution Worker**: Processes triggered orders
* **Order Expiry Worker**: Cleans up expired orders
* **Notification System**: Sends alerts to users about order status

#### Example Scenarios <a href="#example-scenarios" id="example-scenarios"></a>

**Buy Limit Order**

Anna sees a token trading at $0.50 but believes it will drop to $0.40 before rising again. She sets a buy limit order for 5 SOL at a trigger price of $0.40 with a 3-day expiry. If the price drops to $0.40 within 3 days, her order will automatically execute, purchasing the token with her 5 SOL.

**Sell Limit Order**

Bob holds a token currently trading at $1.20 and wants to lock in profits if it reaches $1.50. He creates a sell limit order for 50% of his holdings with a trigger price of $1.50 and a 7-day expiry. If the price rises to $1.50 within 7 days, half of his tokens will be automatically sold.

#### Important Considerations <a href="#important-considerations" id="important-considerations"></a>

* **Expiry Time**: Orders will automatically expire after the set time period
* **Available Balance**: Ensure you have sufficient SOL/tokens when the order executes
* **Price Volatility**: Rapid price movements can affect execution
* **Gas Fees**: Each transaction requires a small amount of SOL for gas
* **Platform Fees**: A small percentage fee applies to each successful order

#### Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

Common issues and solutions:

* **Order Not Executing**: Verify price conditions and check if the order has expired
* **Failed Execution**: Usually due to insufficient balance at execution time
* **Missing Orders**: Orders disappear when executed, expired, or canceled

**Editing Issues**: Some parameters may not be editable after creation


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://grodt-bot.gitbook.io/grodt-trading-bot/advance-features/limit-orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
