据我所知,CCXT 不提供创建订单类型的功能:
“我要花 10 USDT 购买 BTC”
相反,您唯一可以做的就是指定您要购买的基础货币 (BTC) 的数量,如下例所示:
const order = await exchange.createOrder(symbol, 'market', 'buy', amount, price);
或
const symbol = 'BTC/USD';
const amount = 2;
const price = 9000;
cost = amount * price;
const order = await exchange.createMarketBuyOrder (symbol, cost);
有什么我遗漏的东西可以提供我需要的功能吗?
我能想到的唯一解决方案是获取基础货币的价格并计算其等于 10 USDT 的百分比,然后我可以将其用作上述示例中的 amount
。