其他类型的委托单
委托单的类型可以是限价或市价,如果你要限价止损委托类型,可以使用 改写默认参数值,具体参考: https://github.com/ccxt/ccxt/wiki/Manual#overriding-unified-api-params.
下面的代码展示了如何改写委托单类型,然而,你必须阅读交易所的 文档以了解应该使用什么参数以及如何正确设定参数值。限价委托或 市价委托之外的其他类型目前在ccxt中还没有统一的API,只能参考如下 代码改写默认的参数。
const symbol = 'ETH/BTC'
const type = 'limit' // or 'market', other types aren't unified yet
const side = 'sell'
const amount = 123.45 // your amount
const price = 54.321 // your price
// overrides
const params = {
'stopPrice': 123.45, // your stop price
'type': 'stopLimit',
}
const order = await exchange.createOrder (symbol, type, side, amount, price, params)
symbol = 'ETH/BTC'
type = 'limit' # or 'market', other types aren't unified yet
side = 'sell'
amount = 123.45 # your amount
price = 54.321 # your price
# overrides
params = {
'stopPrice': 123.45, # your stop price
'type': 'stopLimit',
}
order = exchange.create_order(symbol, type, side, amount, price, params)
$symbol = 'ETH/BTC';
$type = 'limit'; // or 'market', other types aren't unified yet
$side = 'sell';
$amount = 123.45; // your amount
$price = 54.321; // your price
// overrides
$params = {
'stopPrice': 123.45, // your stop price
'type': 'stopLimit',
}
$order = $exchange->create_order ($symbol, $type, $side, $amount, $price, $params);