|
|
@@ -103,8 +103,8 @@ class BinanceSpot {
|
|
|
}
|
|
|
|
|
|
// 区分买卖情况应该分别传入什么数量
|
|
|
- if (side === 'BUY') data['quoteOrderQty'] = quoteOrderQty
|
|
|
- else if (side === 'SELL') data['quantity'] = quantity
|
|
|
+ if (side === BinanceSpot.TRADE_SIDE.BUY) data['quoteOrderQty'] = quoteOrderQty
|
|
|
+ else if (side === BinanceSpot.TRADE_SIDE.SELL) data['quantity'] = quantity
|
|
|
|
|
|
// MARKET状态不传入price
|
|
|
if (type !== 'MARKET') data['price'] = price
|
|
|
@@ -143,22 +143,22 @@ class BinanceSpot {
|
|
|
return rst
|
|
|
}
|
|
|
|
|
|
- async buy(symbol, price, amount, type=BinanceSpot.TRADE_TYPE.MARKET) {
|
|
|
+ async buy(symbol, price, quoteOrderQty, type=BinanceSpot.TRADE_TYPE.MARKET) {
|
|
|
return await this.takeOrder(
|
|
|
symbol,
|
|
|
price,
|
|
|
BinanceSpot.TRADE_SIDE.BUY,
|
|
|
- amount,
|
|
|
0,
|
|
|
+ quoteOrderQty,
|
|
|
type)
|
|
|
}
|
|
|
|
|
|
- async sell(symbol, price, amount, type=BinanceSpot.TRADE_TYPE.MARKET) {
|
|
|
+ async sell(symbol, price, quantity, type=BinanceSpot.TRADE_TYPE.MARKET) {
|
|
|
return await this.takeOrder(
|
|
|
symbol,
|
|
|
price,
|
|
|
BinanceSpot.TRADE_SIDE.SELL,
|
|
|
- amount,
|
|
|
+ quantity,
|
|
|
0,
|
|
|
type)
|
|
|
}
|