Commit f4eea373 by zihan

风险过高的单,放弃,bug修复

parent 7e66c5e9
...@@ -139,12 +139,14 @@ class BiboxStrategy3 extends Strategy3 { ...@@ -139,12 +139,14 @@ class BiboxStrategy3 extends Strategy3 {
return 0.08; return 0.08;
} }
_giveUpOrder(baseCurrency1, midCurrency, baseCurrency2,totalMarginRate,buyDepth,sellDepth){ _giveUpOrder(baseCurrency1, midCurrency, baseCurrency2,totalMarginRate,buyDepth,sellDepth){
const sellDepth = this.collector.getDepth(midCurrency, baseCurrency2, 2); if(sellDepth ===1){
const possibleLoss = (sellDepth[0][1] - sellDepth[1][1])/sellDepth[0][1]; const sellPrices = this.collector.getDepth(midCurrency, baseCurrency2, 2);
const possibleLoss = (sellPrices[0][0] - sellPrices[1][0])/sellPrices[0][0];
if(possibleLoss*100 > totalMarginRate){ if(possibleLoss*100 > totalMarginRate){
console.log(`此单风险过高,放弃。损失率${possibleLoss}`); console.log(`此单风险过高,放弃。买一:${sellPrices[0][0]},卖二:${sellPrices[1][0]},损失率${possibleLoss}`);
return true; return true;
} }
}
return super._giveUpOrder(baseCurrency1,midCurrency,baseCurrency2,totalMarginRate,buyDepth,sellDepth); return super._giveUpOrder(baseCurrency1,midCurrency,baseCurrency2,totalMarginRate,buyDepth,sellDepth);
} }
......
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