DecentralChain (DCC) icon

DecentralChain (DCC)

Create, sign and broadcast DecentralChain transactions, plus query blockchain data

Overview

The "Place Limit Order" operation in the Matcher resource allows users to create and submit a new limit order on the DecentralChain matcher service. This node is useful for traders or automated systems that want to place buy or sell orders for asset pairs on the DecentralChain decentralized exchange.

Typical use cases include:

  • Placing a buy order to purchase a specific amount of an asset at a desired price.
  • Placing a sell order to sell a specific amount of an asset at a set price.
  • Automating trading strategies by programmatically submitting limit orders with precise parameters.

For example, a user might place a limit order to buy 100 units of Asset A using Asset B as the price asset, specifying the exact price and fee details.

Properties

Name Meaning
Base URL Base URL to use when no API credential is supplied (default: https://nodes.decentralchain.io).
Matcher Base URL Base URL for the Matcher API, used if no matcher credential is supplied (default: https://mainnet-matcher.decentralchain.io).
Amount Asset The asset ID representing the amount asset in the trading pair, or "DCC" for the native token.
Price Asset The asset ID representing the price asset in the trading pair, or "DCC" for the native token.
Use Raw Order JSON Boolean flag indicating whether to provide a raw JSON order body instead of using individual fields. If true, the order JSON must be provided manually.
Order JSON Raw JSON string representing the full order object as required by the matcher API. Required if "Use Raw Order JSON" is true.
Order Type Type of order to place; options are "buy" or "sell".
Amount (Long Units) Amount to trade expressed in the smallest units of the amount asset (e.g., satoshis).
Price (Long Units) Price per unit expressed in matcher long units according to matcher documentation. Required only if not using raw JSON.
Matcher Fee (Long Units) Fee amount in the smallest units of the fee asset to pay for placing the order. Defaults to 300000 (0.003 DCC).
Fee Asset ID Asset ID of the fee asset or "DCC" for the native token.
Sender Public Key Public key of the order sender, used to identify and sign the order.
Expiration (Hours) Duration in hours for which the order remains valid before expiring. Minimum 1 hour, maximum 720 hours (30 days).
Order Version Numeric version of the order format, typically 3.

Output

The node outputs a JSON object containing the response from the matcher API after placing the limit order. The output includes:

  • The matcher API response fields such as order ID, status, and any other metadata returned by the matcher.
  • A debug field with detailed information about the operation, including:
    • Operation name (placeLimitOrder)
    • Endpoint called
    • Matcher base URL used
    • Timestamp of the request
    • The full request body sent to the matcher API

This output allows users to verify the order placement result and debug issues if needed.

Dependencies

  • Requires access to the DecentralChain Matcher API endpoint, either via a configured credential or by specifying the Matcher Base URL.
  • Optionally requires an API authentication token for the matcher service if credentials are used.
  • Uses HTTP requests to communicate with the matcher API.
  • No internal credential names are exposed; users must supply appropriate API keys or URLs as needed.

Troubleshooting

  • Invalid JSON in Order JSON: If "Use Raw Order JSON" is enabled but the provided JSON string is malformed, the node will throw an error indicating invalid JSON. Ensure the JSON is correctly formatted.
  • HTTP Request Failures: Network issues or incorrect Matcher Base URL can cause request failures. Verify the URL and network connectivity.
  • Authentication Errors: If the matcher API requires authentication and no valid token is provided, requests may fail with authorization errors. Provide valid credentials or tokens.
  • Missing Required Fields: Omitting required properties like amountAsset, priceAsset, matcherAmount, matcherPrice, or matcherSenderPublicKey will cause errors. Ensure all mandatory fields are filled.
  • Expiration Hours Out of Range: The expiration time must be between 1 and 720 hours. Values outside this range may cause rejection by the matcher.

Links and References

Discussion