Skip to content
Stove Website

Estimate Order Fee ​

Endpoint Information ​

Endpoint: POST /api/v1/orders/estimate_charge

Description: Estimate order fee with automatic exchange rate conversion. The backend automatically resolves the asset precision on the target chain based on chain_id and target_currency, returning price_target and charge_target in the correct native precision.

Authentication: API Key + Signature. See Authorization

Note: This is a Maker API endpoint. The X-Maker-Addr header is required and must be included in both the request headers and signature string.

Request Parameters ​

FieldTypeRequiredDescription
is_buyboolYesWhether it's a buy order
tickerstringYesStock symbol
exchangeintYesExchange code (0=US Stock, 1=HK Stock)
quantitystringYesQuantity (regular precision)
pricestringYesStock's native currency price (regular precision, NOT wei)
USD for US stocks, HKD for HK stocks
assetstringNoAsset contract address. If provided, it must match the address resolved from target_currency on the specified chain — a mismatch returns a 400 error
target_currencystringNoTarget stablecoin (USDT or USDC), defaults to USDT. The backend resolves the corresponding contract address from the chain whitelist
chain_idintNoChain ID used to resolve the asset address and precision. Defaults to the default chain (BSC) if not provided

Response Parameters ​

FieldTypeDescription
base_currencystringBase currency (USD for US stocks, HKD for HK stocks)
charge_basestringFee in base currency (regular precision)
target_currencystringTarget stablecoin (USDT or USDC)
charge_targetstringFee in target stablecoin (native precision of the asset on the target chain)
price_basestringPrice in base currency (regular precision, same as request price)
price_targetstringPrice in target currency (native precision of the asset on the target chain)
exchange_ratefloatExchange rate from base currency to target currency
chain_idintThe chain ID used for this estimate
asset_addressstringThe resolved asset contract address on the target chain (derived from target_currency and chain_id)

Precision Reference ​

charge_target and price_target precision is determined by chain_id and asset. The backend queries the on-chain contract dynamically:

Chainchain_idUSDT DecimalsExample: 260 USD
BSC (default)5618260000000000000000000
HashKey Chain1776260000000

These fields can be used directly as the price and incentive fields when constructing an order — no client-side precision conversion needed.

Request Examples ​

BSC (omit chain_id, uses default) ​

bash
curl -X POST "{API_BASE_URL}/api/v1/orders/estimate_charge" \
     -H "X-API-Key: YOUR_API_KEY" \
     -H "X-Maker-Addr: YOUR_MAKER_ADDRESS" \
     -H "X-API-Timestamp: 1715100000000" \
     -H "X-API-Signature: GENERATED_SIGNATURE" \
     -H "Content-Type: application/json" \
     -d '{
       "is_buy": true,
       "ticker": "AAPLs",
       "exchange": 0,
       "quantity": "100",
       "price": "260",
       "target_currency": "USDT",
       "chain_id": 56
     }'

HashKey Chain ​

bash
curl -X POST "{API_BASE_URL}/api/v1/orders/estimate_charge" \
     -H "X-API-Key: YOUR_API_KEY" \
     -H "X-Maker-Addr: YOUR_MAKER_ADDRESS" \
     -H "X-API-Timestamp: 1715100000000" \
     -H "X-API-Signature: GENERATED_SIGNATURE" \
     -H "Content-Type: application/json" \
     -d '{
       "is_buy": true,
       "ticker": "AAPLs",
       "exchange": 0,
       "quantity": "100",
       "price": "260",
       "target_currency": "USDT",
       "chain_id": 177
     }'

Response Examples ​

BSC (USDT 18 decimals) ​

json
{
    "code": 0,
    "data": {
        "base_currency": "USD",
        "charge_base": "3.36",
        "target_currency": "USDT",
        "charge_target": "3377745527638190000",
        "price_base": "260",
        "price_target": "261373165829145650000",
        "exchange_rate": 0.994746339683381,
        "chain_id": 56,
        "asset_address": "0x55d398326f99059fF775485246999027B3197955"
    }
}

HashKey Chain (USDT 6 decimals) ​

json
{
    "code": 0,
    "data": {
        "base_currency": "USD",
        "charge_base": "3.36",
        "target_currency": "USDT",
        "charge_target": "3377745",
        "price_base": "260",
        "price_target": "261373165",
        "exchange_rate": 0.994746339683381,
        "chain_id": 177,
        "asset_address": "0xTokenAddressOnHashKey"
    }
}

Notes ​

  • Input precision: quantity and price use regular human-readable precision — do not pass wei values
  • Output precision: charge_target and price_target use the native precision of the asset on the target chain, and can be used directly as order fields
  • Asset address resolution: asset_address in the response is resolved from target_currency + chain_id via the server-side whitelist. Clients can use this value directly as the asset field when constructing an order
  • Asset validation: If asset is provided in the request, it must exactly match the address resolved from target_currency on the specified chain. A mismatch returns a 400 error
  • Different chains use different precisions for the same stablecoin (BSC USDT=18, HashKey USDT=6) — always pass the correct chain_id to get the right precision
  • Fee estimate is for reference only; actual fee is determined at transaction time