Commit d2e33544 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 6072241f
...@@ -39,7 +39,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs,maxT ...@@ -39,7 +39,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs,maxT
let dur let dur
try { try {
dur = getMinDiff(data[0].openDate, data[data.length - 1].closeDate) dur = getNewMinDiff(data[0].openDate, data[data.length - 1].closeDate)
} catch (e) { } catch (e) {
return null return null
...@@ -454,12 +454,12 @@ function getMinDiff(start, closed) { ...@@ -454,12 +454,12 @@ function getMinDiff(start, closed) {
} }
function getNewMinDiff(start, closed) { function getNewMinDiff(s, c) {
//2019-05-25T05:34:27+04:30
var now = moment(closed);
var end = moment.duration(now.diff(moment(start))); const diffInMs = new Date(c) - new Date(s)
// console.log(parseInt(end.asDays())) return diffInMs / (1000 * 60 * 60 * 24);
return parseInt(end.asDays())
} }
......
const fs = require('fs'); const fs = require('fs');
let moment=require('moment-timezone')
tesT()
let closeTime=1611750600000
let openTime=1611304200000
function tesT()
{
const startDate = '2021-01-22 12:00:00';
const endDate = '2021-01-26 12:00:00';
fs.appendFileSync('error.txt', 'test new line\n'); const diffInMs = new Date(endDate) - new Date(startDate)
\ No newline at end of file const diffInDays = diffInMs / (1000 * 60 * 60 * 24);
console.log(diffInDays)
}
//fs.appendFileSync('error.txt', 'test new line\n');
\ No newline at end of file
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