Commit 751ef51d authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 10c9baf8
......@@ -451,6 +451,7 @@ function inlineCheck(money, com, data, profit, lastCom, tar, riskFree, targetPer
let reserve = percentage(money, data.drawDown)
let profitMoney = percentageMinus(money, data.profit)
let targetPrice=getTargetPrice(money,target,data.openPrice,data.side)
let diff = reserve - money
diff = diff - com - lastCom + profit
......@@ -472,6 +473,7 @@ function inlineCheck(money, com, data, profit, lastCom, tar, riskFree, targetPer
profit: profitMoney,
lastCom: lastCom,
com: com,
targetPrice:targetPrice,
target: target,
targetDetail: targetDetail
}
......@@ -486,12 +488,30 @@ function inlineCheck(money, com, data, profit, lastCom, tar, riskFree, targetPer
lastMoney: money,
com: com,
target: target,
targetDetail: targetDetail
targetDetail: targetDetail,
targetPrice:targetPrice
}
}
function getTargetPrice(money,target,basePrice,side) {
let diffMoney = calPer(money, target)
if (side === 'LONG')
return percentageAdv(basePrice, diffMoney)
else
return percentageAdv(basePrice, (-1 * diffMoney))
}
function percentageAdv(base, per) {
base = parseFloat(base)
per = parseFloat(per)
let percentager = per / 100
let temp = base * percentager
return base + temp
}
function calPer(entry, last) {
return ((last - entry) / entry) * 100
......
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