Skip to content

Estimate Order Fee

Endpoint Information

Endpoint: POST /api/v1/orders/estimate_charge

Description: Estimate order fee with automatic exchange rate conversion

Authentication: Authorization header with JWT token

Request Parameters

FieldTypeRequiredDescription
is_buyboolYesWhether it's a buy order
tickerstringYesStock symbol
exchangeintYesExchange code (0=US Stock)
quantitystringYesQuantity (regular precision)
pricestringYesStock's native currency price (regular precision, NOT wei)
USD for US stocks
assetstringYesUSDT contract address
target_currencystringNoTarget stablecoin (USDT or USDC), defaults to USDT

Response Parameters

FieldTypeDescription
base_currencystringBase currency (USD for US stocks)
charge_basestringFee in base currency (regular precision)
target_currencystringTarget stablecoin (USDT or USDC)
charge_targetstringFee in target stablecoin (wei precision, 18 decimals)
price_basestringPrice in base currency (regular precision, same as request price)
price_targetstringPrice in target currency (wei precision, 18 decimals)
exchange_ratefloatExchange rate from base currency to target currency

Request Example

bash
curl -X POST "/api/v1/orders/estimate_charge" \
     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
     -H "Content-Type: application/json" \
     -d '{
       "is_buy": true,
       "ticker": "AAPL",
       "exchange": 0,
       "quantity": "100",
       "price": "260",
       "asset": "0x09671802Cc9Bbf6402f2e7a07b220Aa7b43D8c91"
     }'

Response Example

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
    }
}

Notes

  • Input Parameter Precision:
    • quantity uses regular precision (e.g., "100" means 100 shares)
    • price uses regular precision (e.g., "260" means $260/share), Note: This is the stock's native currency price, NOT wei precision
  • Output Parameter Precision:
    • charge_base uses regular precision
    • charge_target uses wei precision (18 decimals)
    • price_target uses wei precision (18 decimals)
  • Automatic currency conversion from stock's native currency (USD) to target stablecoin
  • Supports target_currency parameter to specify output stablecoin (USDT or USDC), defaults to USDT
  • Fee estimate is for reference only, actual fee is determined at transaction time