Skip to main content

Market Offer Bot

Goal: Build a bot that automatically lists and manages exchange buy orders for a specific fiat currency (e.g., USD).

Key xRocket API Features Used:

  • Private Exchange API Endpoints: For creating and managing offers.
  • Polling: For periodically checking the status of deals and offers.

Workflow

  1. Authorization: Your bot gets authorized with the xRocket API using Bearer Token.
warning

Since this bot uses private endpoints that can create orders and manage funds, keep your Bearer Token secure. Store it in environment variables or a secrets manager -- never hardcode it in source files.

  1. Offer Creation: The bot calls a private endpoint to create a new buy order, specifying the crypto pair (for example, BTC-USDT) and price.
  2. Offer/Deal Monitoring (Polling): The bot periodically polls the GET /api/v1/trades or GET /api/v1/orderbook endpoints to check the status of its active offers and trades.
  3. Automated Response: When the bot detects that a deal has been accepted or its status has changed, it can take further automated actions, such as sending a confirmation message or tracking the deal.
  4. Offer Management: Your bot can also use polling to monitor for expired or fully completed offers and manage them accordingly.
tip

For real-time order and balance updates, consider using the WebSocket API instead of polling REST endpoints. The private channels for Active Orders and Balances are particularly useful for bots.