Skip to main content

8. Test Xerolite Order Execution (Safe Test)

Before using XeroLite with real money, it's crucial to test order execution in a safe environment. This section guides you through testing XeroLite with paper trading.

8.1: Enable Paper Trading Mode

Switch to Paper Trading Account

  1. Log in to Paper Trading Account:
    • In TWS/IB Gateway, ensure you're logged into your Paper Trading account
    • Paper Trading accounts allow you to test without real money
    • If you don't have a paper trading account, create one in your IB account settings
  2. Verify Paper Trading Mode:
    • Check TWS/IB Gateway interface for "Paper Trading" indicator
    • Account number should reflect paper trading account
    • Confirm you're not logged into a live account
  3. Update XeroLite Connection:
    • If you were connected to a live account, disconnect and reconnect
    • Ensure XeroLite connects to your paper trading account
    • Verify account information shows paper trading account

Paper Trading Benefits

  • Risk-Free Testing: Test strategies without financial risk
  • Real Market Conditions: Uses real market data and conditions
  • Full Feature Access: Test all XeroLite features safely
  • Learning Opportunity: Understand order execution without consequences

8.2: Trigger a Test Signal

Create a Test Alert

  1. Use Alert Request Builder:
    • In XeroLite, navigate to Alert Request Builder
    • Build a simple test alert (see Alert Request Builder)
    • Use a small quantity for testing (e.g., 1 share)
  2. Configure Test Alert:
    • Select a common symbol (e.g., AAPL, MSFT)
    • Set order type to MARKET for immediate execution
    • Use a small quantity to minimize impact
    • Set action to BUY or SELL
  3. Send Test Alert:
    • Use the Test Place Order feature if available
    • Or send a test alert from TradingView (if configured)
    • Monitor the alert in XeroLite's incoming alerts log

Test Alert Example

{
"name": "TEST_ORDER_001",
"symbol": "AAPL",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART",
"action": "BUY",
"qty": "1",
"order_type": "MARKET"
}

Monitor Alert Processing

  1. Check Incoming Alerts:
    • Navigate to Incoming Alerts tab in XeroLite
    • Verify your test alert appears in the log
    • Check alert status (Success, Error, etc.)
  2. Review Alert Details:
    • Click on the alert to see detailed information
    • Verify all fields were parsed correctly
    • Check for any validation errors

8.3: Confirm Order Sent to IB

Verify Order Execution

  1. Check Transaction Log:
    • Navigate to Transactions tab in XeroLite
    • Look for your test order in the transaction history
    • Verify order status (Filled, Pending, Rejected, etc.)
  2. Verify in TWS:
    • Open TWS and check the Orders tab
    • Look for the order sent by XeroLite
    • Verify order details match your alert (symbol, quantity, action)
  3. Check Execution:
    • If using MARKET orders, execution should be immediate
    • For LIMIT orders, check if order is pending or filled
    • Verify fill price and execution time

Order Status Indicators

  • Filled: Order executed successfully
  • Pending: Order submitted and waiting
  • Rejected: Order was rejected by IB
  • Cancelled: Order was cancelled

Verify Order Details

Confirm the following match your test alert:

  • Symbol: Correct stock symbol
  • Action: BUY or SELL matches
  • Quantity: Correct number of shares
  • Order Type: MARKET, LIMIT, etc.
  • Account: Correct IB account

Test Different Order Types

Once basic order execution works, test:

  1. Market Orders: Immediate execution
  2. Limit Orders: Orders at specific prices
  3. Stop Orders: Stop-loss functionality
  4. Bracket Orders: Orders with take-profit and stop-loss

Troubleshooting Test Orders

Order Not Appearing in TWS

  • Check Connection: Verify XeroLite is connected to IB
  • Check API Settings: Ensure API precautions are configured
  • Check Order Log: Review XeroLite transaction log for errors
  • Verify Account: Confirm you're using the correct IB account

Order Rejected

  • Check Account Permissions: Ensure account allows trading
  • Verify Symbol: Confirm symbol is valid and tradeable
  • Check Market Hours: Some orders may be rejected outside market hours
  • Review Error Messages: Check TWS for specific rejection reasons

Order Not Executing

  • Market Orders: Should execute immediately during market hours
  • Limit Orders: Will only execute if price reaches limit
  • Check Market Status: Ensure markets are open
  • Verify Quantity: Ensure quantity is valid (not too large)

Safety Reminders

  • Always test with Paper Trading first
  • Use small quantities for testing
  • Verify order details before confirming
  • Monitor first few orders closely
  • Keep TWS visible to watch orders

Next Steps

After successfully testing order execution, proceed to:


Need more help? Contact support at [email protected]

See also: