Place Order (Shared Implementation)
Source:R/impl_spottrading_orders_add_order.R
place_order_helper.Rd
This is a shared helper function for placing orders or testing order placement on the KuCoin Spot trading system. It handles parameter validation, request body construction, authentication, API request sending, and response processing.
Usage
place_order_helper(
keys = get_api_keys(),
base_url = get_base_url(),
endpoint,
type,
symbol,
side,
clientOid = NULL,
price = NULL,
size = NULL,
funds = NULL,
stp = NULL,
tags = NULL,
remark = NULL,
timeInForce = NULL,
cancelAfter = NULL,
postOnly = NULL,
hidden = NULL,
iceberg = NULL,
visibleSize = NULL,
.__coro_env_parent__ = <environment>
)
Arguments
- keys
List; API configuration parameters from
get_api_keys()
, including:api_key
(character): KuCoin API key.api_secret
(character): KuCoin API secret.api_passphrase
(character): KuCoin API passphrase.key_version
(character): API key version (e.g., "2"). Defaults toget_api_keys()
.
- base_url
Character string; base URL for the KuCoin API. Defaults to
get_base_url()
.- endpoint
Character string; the API endpoint to use (e.g., "/api/v1/hf/orders" or "/api/v1/hf/orders/test").
- type
Character string; order type: "limit" or "market". Required.
- symbol
Character string; trading pair (e.g., "BTC-USDT"). Required.
- side
Character string; order side: "buy" or "sell". Required.
- clientOid
Character string; unique client order ID (recommended UUID, max 40 chars). Optional.
- price
Character string; price for limit orders (must align with priceIncrement). Required for limit orders.
- size
Character string; quantity for limit or market orders (must align with baseIncrement). Required for limit, optional for market.
- funds
Character string; funds for market orders (must align with quoteIncrement). Optional for market, mutually exclusive with size.
- stp
Character string; self-trade prevention strategy: "CN", "CO", "CB", or "DC". Optional.
Character string; order tag (max 20 ASCII chars). Optional.
- remark
Character string; order remarks (max 20 ASCII chars). Optional.
- timeInForce
Character string; time-in-force strategy: "GTC", "GTT", "IOC", or "FOK". Optional, defaults to "GTC".
- cancelAfter
Integer; cancel after n seconds (for GTT). Optional.
- postOnly
Logical; passive order flag (disabled for IOC/FOK). Optional, defaults to FALSE.
Logical; hide order from order book. Optional, defaults to FALSE.
- iceberg
Logical; show only visible portion in iceberg orders. Optional, defaults to FALSE.
- visibleSize
Character string; max visible quantity for iceberg orders. Optional.