Merge pull request #1518 from mempool/simon/remove-locutus-lib

Breaking out strtotime from locutus lib
This commit is contained in:
wiz 2022-04-14 21:33:21 +00:00 committed by GitHub
commit 9cb8f64bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1381 additions and 35 deletions

View File

@ -15,7 +15,6 @@
"bitcoinjs-lib": "6.0.1",
"crypto-js": "^4.0.0",
"express": "^4.17.1",
"locutus": "^2.0.12",
"mysql2": "2.3.3",
"node-worker-threads-pool": "^1.4.3",
"socks-proxy-agent": "^6.1.1",
@ -25,7 +24,6 @@
"devDependencies": {
"@types/compression": "^1.0.1",
"@types/express": "^4.17.2",
"@types/locutus": "^0.0.6",
"tslint": "^6.1.0"
}
},
@ -114,12 +112,6 @@
"@types/range-parser": "*"
}
},
"node_modules/@types/locutus": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/locutus/-/locutus-0.0.6.tgz",
"integrity": "sha512-P+BQds4wrJhqKiIOBWAYpbsE9UOztnnqW9zHk4Bci7kCXjEQAA7FJrD9HX5JU2Z36fhE2WDctuuIpLvqDsciWQ==",
"dev": true
},
"node_modules/@types/mime": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz",
@ -804,14 +796,6 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/locutus": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.15.tgz",
"integrity": "sha512-2xWC4RkoAoCVXEb/stzEgG1TNgd+mrkLBj6TuEDNyUoKeQ2XzDTyJUC23sMiqbL6zJmJSP3w59OZo+zc4IBOmA==",
"engines": {
"node": ">= 10"
}
},
"node_modules/long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
@ -1562,12 +1546,6 @@
"@types/range-parser": "*"
}
},
"@types/locutus": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/locutus/-/locutus-0.0.6.tgz",
"integrity": "sha512-P+BQds4wrJhqKiIOBWAYpbsE9UOztnnqW9zHk4Bci7kCXjEQAA7FJrD9HX5JU2Z36fhE2WDctuuIpLvqDsciWQ==",
"dev": true
},
"@types/mime": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz",
@ -2135,11 +2113,6 @@
"esprima": "^4.0.0"
}
},
"locutus": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.15.tgz",
"integrity": "sha512-2xWC4RkoAoCVXEb/stzEgG1TNgd+mrkLBj6TuEDNyUoKeQ2XzDTyJUC23sMiqbL6zJmJSP3w59OZo+zc4IBOmA=="
},
"long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",

View File

@ -34,7 +34,6 @@
"bitcoinjs-lib": "6.0.1",
"crypto-js": "^4.0.0",
"express": "^4.17.1",
"locutus": "^2.0.12",
"mysql2": "2.3.3",
"node-worker-threads-pool": "^1.4.3",
"socks-proxy-agent": "^6.1.1",
@ -44,7 +43,6 @@
"devDependencies": {
"@types/compression": "^1.0.1",
"@types/express": "^4.17.2",
"@types/locutus": "^0.0.6",
"tslint": "^6.1.0"
}
}

View File

@ -1,7 +1,7 @@
import { Currencies, OffersData, TradesData, Depth, Currency, Interval, HighLowOpenClose,
Markets, Offers, Offer, BisqTrade, MarketVolume, Tickers, Ticker, SummarizedIntervals, SummarizedInterval } from './interfaces';
import * as datetime from 'locutus/php/datetime';
const strtotime = require('./strtotime');
class BisqMarketsApi {
private cryptoCurrencyData: Currency[] = [];
@ -312,7 +312,7 @@ class BisqMarketsApi {
getTickerFromMarket(market: string): Ticker | null {
let ticker: Ticker;
const timestamp_from = datetime.strtotime('-24 hour');
const timestamp_from = strtotime('-24 hour');
const timestamp_to = new Date().getTime() / 1000;
const trades = this.getTradesByCriteria(market, timestamp_to, timestamp_from,
undefined, undefined, undefined, 'asc', Number.MAX_SAFE_INTEGER);
@ -638,13 +638,13 @@ class BisqMarketsApi {
case 'half_day':
return (ts - (ts % (3600 * 12)));
case 'day':
return datetime.strtotime('midnight today', ts);
return strtotime('midnight today', ts);
case 'week':
return datetime.strtotime('midnight sunday last week', ts);
return strtotime('midnight sunday last week', ts);
case 'month':
return datetime.strtotime('midnight first day of this month', ts);
return strtotime('midnight first day of this month', ts);
case 'year':
return datetime.strtotime('midnight first day of january', ts);
return strtotime('midnight first day of january', ts);
default:
throw new Error('Unsupported interval: ' + interval);
}

File diff suppressed because it is too large Load Diff