Commit 6e81711e by rongjun

bug

parent 434b44e2
...@@ -84,12 +84,13 @@ class BiboxStrategy3 extends Strategy3 { ...@@ -84,12 +84,13 @@ class BiboxStrategy3 extends Strategy3 {
if (order.executedQty === order.origQty) { if (order.executedQty === order.origQty) {
console.log("买入全部成交"); console.log("买入全部成交");
createdBuyOrder = true; createdBuyOrder = true;
amount = collector.processAmount(midCurrency, baseCurrency2, parseFloat(order.executedQty*0.999));
sellOrder(); sellOrder();
returnOrder(); returnOrder();
} else if (parseFloat(order.executedQty) > 0) { } else if (parseFloat(order.executedQty) > 0) {
returnAmount = parseFloat(returnAmount) * parseFloat(order.executedQty) / parseFloat(amount); returnAmount = parseFloat(returnAmount) * parseFloat(order.executedQty) / parseFloat(amount);
returnAmount = collector.processAmount(baseCurrency2, baseCurrency1, returnAmount); returnAmount = collector.processAmount(baseCurrency2, baseCurrency1, returnAmount);
amount = collector.processAmount(midCurrency, baseCurrency2, parseFloat(order.executedQty)); amount = collector.processAmount(midCurrency, baseCurrency2, parseFloat(order.executedQty*0.999));
console.log(`买入部分成交${order.executedQty} 回归量调整为${returnAmount}`); console.log(`买入部分成交${order.executedQty} 回归量调整为${returnAmount}`);
order.remark = "部分成交@amount " + order.executedQty + ";"; order.remark = "部分成交@amount " + order.executedQty + ";";
createdBuyOrder = true; createdBuyOrder = true;
......
...@@ -22,18 +22,15 @@ function returnFakeOrder(symbol, price, amount) { ...@@ -22,18 +22,15 @@ function returnFakeOrder(symbol, price, amount) {
function convertToRecordOrder(order) { function convertToRecordOrder(order) {
let status = constants.OrderStatusNew; let status = constants.OrderStatusNew;
if(!order.isActive){
status = constants.OrderStatusCanceled;
}else{
if(order.pendingAmount === 0){ if(order.pendingAmount === 0){
status = constants.OrderStatusFilled; status = constants.OrderStatusFilled;
} }else{
// if(order.dealAmount === 0){ if(order.dealAmount > 0){
// status = constants.OrderStatusNew;
// }
if(order.dealAmount > 0 && order.pendingAmount >0){
status = constants.OrderStatusPartiallyFilled; status = constants.OrderStatusPartiallyFilled;
} }
if(!order.isActive && order.dealAmount === 0){
status = constants.OrderStatusCanceled;
}
} }
return { return {
orderId: order.orderOid + '', orderId: order.orderOid + '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment