Commit 799d1fd8 by zihan

为了测试调整了部分代码

parent a9eb0bca
......@@ -89,12 +89,13 @@ class BiboxCollector extends BaseCollector{
}
processAmount(fromCurrency,toCurrency,amount){
//有可能会由于数值过小,传进来的amount被表示为科学计数法法
const amountStr = parseFloat(amount).toFixed(10);
const nums = amountStr.split('.');
if(nums.length ===2 && nums[1].length>4){
return nums[0]+"."+nums[1].slice(0,4);
}
return amount;
// const amountStr = parseFloat(amount).toFixed(10);
// const nums = amountStr.split('.');
// if(nums.length ===2 && nums[1].length>4){
// return nums[0]+"."+nums[1].slice(0,4);
// }
// return amount;
return amount ; //todo 根据平台情况再定
}
processPrice(fromCurrency,toCurrency,price){
// const amountStr = price+'';
......@@ -105,8 +106,10 @@ class BiboxCollector extends BaseCollector{
return price;
}
getCurrencyMaxReturnAmount(currency){
const balance = this.getCurrencyBalance(currency);
return Math.min(Strategy3MaxAmountMap[currency],balance);
// const balance = this.getCurrencyBalance(currency);
// return Math.min(Strategy3MaxAmountMap[currency],balance);
//todo 当前没有底仓暂时先不考虑底仓的情况
return Strategy3MaxAmountMap[currency];
}
getDepthPrintStr(fromCurrency,toCurrency,depth=1){
return super.getDepthPrintStr(fromCurrency,toCurrency,3);
......
......@@ -16,6 +16,7 @@ class BiboxStrategy3 extends Strategy3 {
}
_doTrade(baseCurrency1, midCurrency, baseCurrency2, buyPrice, sellPrice, returnPrice, amount, returnAmount, doSaveOrder) {
return; //todo remove test stub
const buySymbol = this.collector.getSymbol(baseCurrency1, midCurrency);
const buyStartTime = Date.now();
const collector = this.collector;
......@@ -134,7 +135,10 @@ class BiboxStrategy3 extends Strategy3 {
_needConsiderDepthCount(){
return [[2,1],[3,2,1],[2,1]];
}
//todo 暂时使用最激进的方式
_giveUpOrder(){
return false;
}
}
const BiboxCollector = require('./lbankCollector');
......
......@@ -6,7 +6,9 @@
"scripts": {
"strategy2": "node $NODE_DEBUG_OPTION strategy2.js",
"test": "node $NODE_DEBUG_OPTION test_lbank.js",
"strategy3": "export MACHINE='L'; node $NODE_DEBUG_OPTION lbankStrategy3.js"
"strategy3": "export MACHINE='L'; node $NODE_DEBUG_OPTION lbankStrategy3.js",
"strategy3Test": "export MACHINE='L';export agent='socks:127.0.0.1:1086';export http_proxy='http://localhost:8118';export https_proxy='http://localhost:8118';node $NODE_DEBUG_OPTION lbankStrategy3.js"
},
"author": "",
"license": "ISC",
......
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