@adaptic/utils 0.0.992 → 0.0.994
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/dist/index.cjs +73 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +73 -79
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +0 -220
- package/dist/test.js.map +1 -1
- package/dist/types/technical-analysis.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
# @adaptic/utils
|
|
2
2
|
|
|
3
|
-
Last updated: 20 Feb 2025
|
|
4
|
-
|
|
5
3
|
A comprehensive utility library for financial data processing, time manipulation, and formatting.
|
|
6
4
|
|
|
7
5
|
NPM repo: https://www.npmjs.com/package/@adaptic/utils
|
|
8
6
|
|
|
7
|
+
## Branch Model
|
|
8
|
+
|
|
9
|
+
This repo has two publish lineages:
|
|
10
|
+
|
|
11
|
+
- `master` -> `@adaptic/utils@0.1.x` on npm dist-tag `latest`. What external
|
|
12
|
+
unpinned `npm install @adaptic/utils` will pull.
|
|
13
|
+
- `stable-release` -> `@adaptic/utils@0.0.x` (0.0.992+) on npm dist-tag
|
|
14
|
+
`stable`. What `engine` and `backend-legacy` actually consume via pinned
|
|
15
|
+
versions.
|
|
16
|
+
|
|
17
|
+
All new work lands on `stable-release`. `master` is only updated when
|
|
18
|
+
intentionally cutting a 0.1.x patch for legacy external consumers.
|
|
19
|
+
|
|
9
20
|
## Installation
|
|
10
21
|
|
|
11
22
|
```bash
|
|
12
|
-
npm install @adaptic/utils
|
|
23
|
+
npm install @adaptic/utils # 0.1.x from master
|
|
24
|
+
npm install @adaptic/utils@stable # 0.0.x from stable-release (engine pins this)
|
|
13
25
|
```
|
|
14
26
|
|
|
15
27
|
## Usage
|
package/dist/index.cjs
CHANGED
|
@@ -11617,7 +11617,6 @@ function calculateBollingerBands(priceData, { period = 20, standardDeviations =
|
|
|
11617
11617
|
close: priceData[i].close,
|
|
11618
11618
|
});
|
|
11619
11619
|
}
|
|
11620
|
-
// logIfDebug(`Calculated Bollinger Bands for ${result.length} periods`);
|
|
11621
11620
|
return result;
|
|
11622
11621
|
}
|
|
11623
11622
|
/**
|
|
@@ -11680,7 +11679,6 @@ function calculateEMA(priceData, { period = 20, period2 = 9 } = {}) {
|
|
|
11680
11679
|
}
|
|
11681
11680
|
result.push(entry);
|
|
11682
11681
|
}
|
|
11683
|
-
// logIfDebug(`Calculated EMA for ${result.length} periods`);
|
|
11684
11682
|
return result;
|
|
11685
11683
|
}
|
|
11686
11684
|
/**
|
|
@@ -11742,7 +11740,6 @@ function calculateFibonacciLevels(priceData, { lookbackPeriod = 20, retracementL
|
|
|
11742
11740
|
close: priceData[i].close,
|
|
11743
11741
|
});
|
|
11744
11742
|
}
|
|
11745
|
-
// logIfDebug(`Calculated Fibonacci levels for ${result.length} periods`);
|
|
11746
11743
|
return result;
|
|
11747
11744
|
}
|
|
11748
11745
|
/**
|
|
@@ -11790,7 +11787,6 @@ function calculateMACD(priceData, { shortPeriod = 12, longPeriod = 26, signalPer
|
|
|
11790
11787
|
close: emaLong[i].close,
|
|
11791
11788
|
});
|
|
11792
11789
|
}
|
|
11793
|
-
// logIfDebug(`Calculated MACD for ${result.length} periods`);
|
|
11794
11790
|
return result;
|
|
11795
11791
|
}
|
|
11796
11792
|
/**
|
|
@@ -11846,7 +11842,6 @@ function calculateRSI(priceData, { period = 14 } = {}) {
|
|
|
11846
11842
|
close: priceData[i].close,
|
|
11847
11843
|
});
|
|
11848
11844
|
}
|
|
11849
|
-
// logIfDebug(`Calculated RSI for ${result.length} periods`);
|
|
11850
11845
|
return result;
|
|
11851
11846
|
}
|
|
11852
11847
|
/**
|
|
@@ -11899,7 +11894,6 @@ function calculateStochasticOscillator(priceData, { lookbackPeriod = 5, signalPe
|
|
|
11899
11894
|
});
|
|
11900
11895
|
}
|
|
11901
11896
|
}
|
|
11902
|
-
// logIfDebug(`Calculated Stochastic Oscillator for ${result.length} periods`);
|
|
11903
11897
|
return result;
|
|
11904
11898
|
}
|
|
11905
11899
|
/**
|
|
@@ -13846,17 +13840,17 @@ var hasRequiredBrowser;
|
|
|
13846
13840
|
function requireBrowser () {
|
|
13847
13841
|
if (hasRequiredBrowser) return browser.exports;
|
|
13848
13842
|
hasRequiredBrowser = 1;
|
|
13849
|
-
(function (module, exports
|
|
13843
|
+
(function (module, exports) {
|
|
13850
13844
|
/**
|
|
13851
13845
|
* This is the web browser implementation of `debug()`.
|
|
13852
13846
|
*/
|
|
13853
13847
|
|
|
13854
|
-
exports
|
|
13855
|
-
exports
|
|
13856
|
-
exports
|
|
13857
|
-
exports
|
|
13858
|
-
exports
|
|
13859
|
-
exports
|
|
13848
|
+
exports.formatArgs = formatArgs;
|
|
13849
|
+
exports.save = save;
|
|
13850
|
+
exports.load = load;
|
|
13851
|
+
exports.useColors = useColors;
|
|
13852
|
+
exports.storage = localstorage();
|
|
13853
|
+
exports.destroy = (() => {
|
|
13860
13854
|
let warned = false;
|
|
13861
13855
|
|
|
13862
13856
|
return () => {
|
|
@@ -13871,7 +13865,7 @@ function requireBrowser () {
|
|
|
13871
13865
|
* Colors.
|
|
13872
13866
|
*/
|
|
13873
13867
|
|
|
13874
|
-
exports
|
|
13868
|
+
exports.colors = [
|
|
13875
13869
|
'#0000CC',
|
|
13876
13870
|
'#0000FF',
|
|
13877
13871
|
'#0033CC',
|
|
@@ -14036,7 +14030,7 @@ function requireBrowser () {
|
|
|
14036
14030
|
*
|
|
14037
14031
|
* @api public
|
|
14038
14032
|
*/
|
|
14039
|
-
exports
|
|
14033
|
+
exports.log = console.debug || console.log || (() => {});
|
|
14040
14034
|
|
|
14041
14035
|
/**
|
|
14042
14036
|
* Save `namespaces`.
|
|
@@ -14047,9 +14041,9 @@ function requireBrowser () {
|
|
|
14047
14041
|
function save(namespaces) {
|
|
14048
14042
|
try {
|
|
14049
14043
|
if (namespaces) {
|
|
14050
|
-
exports
|
|
14044
|
+
exports.storage.setItem('debug', namespaces);
|
|
14051
14045
|
} else {
|
|
14052
|
-
exports
|
|
14046
|
+
exports.storage.removeItem('debug');
|
|
14053
14047
|
}
|
|
14054
14048
|
} catch (error) {
|
|
14055
14049
|
// Swallow
|
|
@@ -14066,7 +14060,7 @@ function requireBrowser () {
|
|
|
14066
14060
|
function load() {
|
|
14067
14061
|
let r;
|
|
14068
14062
|
try {
|
|
14069
|
-
r = exports
|
|
14063
|
+
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
|
14070
14064
|
} catch (error) {
|
|
14071
14065
|
// Swallow
|
|
14072
14066
|
// XXX (@Qix-) should we be logging these?
|
|
@@ -14102,7 +14096,7 @@ function requireBrowser () {
|
|
|
14102
14096
|
}
|
|
14103
14097
|
}
|
|
14104
14098
|
|
|
14105
|
-
module.exports = requireCommon()(exports
|
|
14099
|
+
module.exports = requireCommon()(exports);
|
|
14106
14100
|
|
|
14107
14101
|
const {formatters} = module.exports;
|
|
14108
14102
|
|
|
@@ -14291,7 +14285,7 @@ var hasRequiredNode$1;
|
|
|
14291
14285
|
function requireNode$1 () {
|
|
14292
14286
|
if (hasRequiredNode$1) return node$1.exports;
|
|
14293
14287
|
hasRequiredNode$1 = 1;
|
|
14294
|
-
(function (module, exports
|
|
14288
|
+
(function (module, exports) {
|
|
14295
14289
|
const tty = require$$1$1;
|
|
14296
14290
|
const util = require$$1$2;
|
|
14297
14291
|
|
|
@@ -14299,13 +14293,13 @@ function requireNode$1 () {
|
|
|
14299
14293
|
* This is the Node.js implementation of `debug()`.
|
|
14300
14294
|
*/
|
|
14301
14295
|
|
|
14302
|
-
exports
|
|
14303
|
-
exports
|
|
14304
|
-
exports
|
|
14305
|
-
exports
|
|
14306
|
-
exports
|
|
14307
|
-
exports
|
|
14308
|
-
exports
|
|
14296
|
+
exports.init = init;
|
|
14297
|
+
exports.log = log;
|
|
14298
|
+
exports.formatArgs = formatArgs;
|
|
14299
|
+
exports.save = save;
|
|
14300
|
+
exports.load = load;
|
|
14301
|
+
exports.useColors = useColors;
|
|
14302
|
+
exports.destroy = util.deprecate(
|
|
14309
14303
|
() => {},
|
|
14310
14304
|
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
14311
14305
|
);
|
|
@@ -14314,7 +14308,7 @@ function requireNode$1 () {
|
|
|
14314
14308
|
* Colors.
|
|
14315
14309
|
*/
|
|
14316
14310
|
|
|
14317
|
-
exports
|
|
14311
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
14318
14312
|
|
|
14319
14313
|
try {
|
|
14320
14314
|
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
@@ -14322,7 +14316,7 @@ function requireNode$1 () {
|
|
|
14322
14316
|
const supportsColor = requireSupportsColor();
|
|
14323
14317
|
|
|
14324
14318
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
14325
|
-
exports
|
|
14319
|
+
exports.colors = [
|
|
14326
14320
|
20,
|
|
14327
14321
|
21,
|
|
14328
14322
|
26,
|
|
@@ -14411,7 +14405,7 @@ function requireNode$1 () {
|
|
|
14411
14405
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
14412
14406
|
*/
|
|
14413
14407
|
|
|
14414
|
-
exports
|
|
14408
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
14415
14409
|
return /^debug_/i.test(key);
|
|
14416
14410
|
}).reduce((obj, key) => {
|
|
14417
14411
|
// Camel-case
|
|
@@ -14443,8 +14437,8 @@ function requireNode$1 () {
|
|
|
14443
14437
|
*/
|
|
14444
14438
|
|
|
14445
14439
|
function useColors() {
|
|
14446
|
-
return 'colors' in exports
|
|
14447
|
-
Boolean(exports
|
|
14440
|
+
return 'colors' in exports.inspectOpts ?
|
|
14441
|
+
Boolean(exports.inspectOpts.colors) :
|
|
14448
14442
|
tty.isatty(process.stderr.fd);
|
|
14449
14443
|
}
|
|
14450
14444
|
|
|
@@ -14470,7 +14464,7 @@ function requireNode$1 () {
|
|
|
14470
14464
|
}
|
|
14471
14465
|
|
|
14472
14466
|
function getDate() {
|
|
14473
|
-
if (exports
|
|
14467
|
+
if (exports.inspectOpts.hideDate) {
|
|
14474
14468
|
return '';
|
|
14475
14469
|
}
|
|
14476
14470
|
return new Date().toISOString() + ' ';
|
|
@@ -14481,7 +14475,7 @@ function requireNode$1 () {
|
|
|
14481
14475
|
*/
|
|
14482
14476
|
|
|
14483
14477
|
function log(...args) {
|
|
14484
|
-
return process.stderr.write(util.formatWithOptions(exports
|
|
14478
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
|
14485
14479
|
}
|
|
14486
14480
|
|
|
14487
14481
|
/**
|
|
@@ -14521,13 +14515,13 @@ function requireNode$1 () {
|
|
|
14521
14515
|
function init(debug) {
|
|
14522
14516
|
debug.inspectOpts = {};
|
|
14523
14517
|
|
|
14524
|
-
const keys = Object.keys(exports
|
|
14518
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
14525
14519
|
for (let i = 0; i < keys.length; i++) {
|
|
14526
|
-
debug.inspectOpts[keys[i]] = exports
|
|
14520
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
14527
14521
|
}
|
|
14528
14522
|
}
|
|
14529
14523
|
|
|
14530
|
-
module.exports = requireCommon()(exports
|
|
14524
|
+
module.exports = requireCommon()(exports);
|
|
14531
14525
|
|
|
14532
14526
|
const {formatters} = module.exports;
|
|
14533
14527
|
|
|
@@ -15101,7 +15095,7 @@ function requireFollowRedirects () {
|
|
|
15101
15095
|
// Wraps the key/value object of protocols with redirect functionality
|
|
15102
15096
|
function wrap(protocols) {
|
|
15103
15097
|
// Default settings
|
|
15104
|
-
var exports
|
|
15098
|
+
var exports = {
|
|
15105
15099
|
maxRedirects: 21,
|
|
15106
15100
|
maxBodyLength: 10 * 1024 * 1024,
|
|
15107
15101
|
};
|
|
@@ -15111,7 +15105,7 @@ function requireFollowRedirects () {
|
|
|
15111
15105
|
Object.keys(protocols).forEach(function (scheme) {
|
|
15112
15106
|
var protocol = scheme + ":";
|
|
15113
15107
|
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
15114
|
-
var wrappedProtocol = exports
|
|
15108
|
+
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
|
15115
15109
|
|
|
15116
15110
|
// Executes a request, following redirects
|
|
15117
15111
|
function request(input, options, callback) {
|
|
@@ -15134,8 +15128,8 @@ function requireFollowRedirects () {
|
|
|
15134
15128
|
|
|
15135
15129
|
// Set defaults
|
|
15136
15130
|
options = Object.assign({
|
|
15137
|
-
maxRedirects: exports
|
|
15138
|
-
maxBodyLength: exports
|
|
15131
|
+
maxRedirects: exports.maxRedirects,
|
|
15132
|
+
maxBodyLength: exports.maxBodyLength,
|
|
15139
15133
|
}, input, options);
|
|
15140
15134
|
options.nativeProtocols = nativeProtocols;
|
|
15141
15135
|
if (!isString(options.host) && !isString(options.hostname)) {
|
|
@@ -15160,7 +15154,7 @@ function requireFollowRedirects () {
|
|
|
15160
15154
|
get: { value: get, configurable: true, enumerable: true, writable: true },
|
|
15161
15155
|
});
|
|
15162
15156
|
});
|
|
15163
|
-
return exports
|
|
15157
|
+
return exports;
|
|
15164
15158
|
}
|
|
15165
15159
|
|
|
15166
15160
|
function noop() { /* empty */ }
|
|
@@ -16766,7 +16760,7 @@ var hasRequiredLodash;
|
|
|
16766
16760
|
function requireLodash () {
|
|
16767
16761
|
if (hasRequiredLodash) return lodash$1.exports;
|
|
16768
16762
|
hasRequiredLodash = 1;
|
|
16769
|
-
(function (module, exports
|
|
16763
|
+
(function (module, exports) {
|
|
16770
16764
|
(function() {
|
|
16771
16765
|
|
|
16772
16766
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
@@ -17197,7 +17191,7 @@ function requireLodash () {
|
|
|
17197
17191
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
17198
17192
|
|
|
17199
17193
|
/** Detect free variable `exports`. */
|
|
17200
|
-
var freeExports = exports
|
|
17194
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
17201
17195
|
|
|
17202
17196
|
/** Detect free variable `module`. */
|
|
17203
17197
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -35027,12 +35021,12 @@ var hasRequiredIsBuffer;
|
|
|
35027
35021
|
function requireIsBuffer () {
|
|
35028
35022
|
if (hasRequiredIsBuffer) return isBuffer.exports;
|
|
35029
35023
|
hasRequiredIsBuffer = 1;
|
|
35030
|
-
(function (module, exports
|
|
35024
|
+
(function (module, exports) {
|
|
35031
35025
|
var root = require_root(),
|
|
35032
35026
|
stubFalse = requireStubFalse();
|
|
35033
35027
|
|
|
35034
35028
|
/** Detect free variable `exports`. */
|
|
35035
|
-
var freeExports = exports
|
|
35029
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
35036
35030
|
|
|
35037
35031
|
/** Detect free variable `module`. */
|
|
35038
35032
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -35252,11 +35246,11 @@ var hasRequired_nodeUtil;
|
|
|
35252
35246
|
function require_nodeUtil () {
|
|
35253
35247
|
if (hasRequired_nodeUtil) return _nodeUtil.exports;
|
|
35254
35248
|
hasRequired_nodeUtil = 1;
|
|
35255
|
-
(function (module, exports
|
|
35249
|
+
(function (module, exports) {
|
|
35256
35250
|
var freeGlobal = require_freeGlobal();
|
|
35257
35251
|
|
|
35258
35252
|
/** Detect free variable `exports`. */
|
|
35259
|
-
var freeExports = exports
|
|
35253
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
35260
35254
|
|
|
35261
35255
|
/** Detect free variable `module`. */
|
|
35262
35256
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
@@ -44178,7 +44172,7 @@ var hasRequiredSafeBuffer;
|
|
|
44178
44172
|
function requireSafeBuffer () {
|
|
44179
44173
|
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
44180
44174
|
hasRequiredSafeBuffer = 1;
|
|
44181
|
-
(function (module, exports
|
|
44175
|
+
(function (module, exports) {
|
|
44182
44176
|
/* eslint-disable node/no-deprecated-api */
|
|
44183
44177
|
var buffer = require$$0$5;
|
|
44184
44178
|
var Buffer = buffer.Buffer;
|
|
@@ -44193,8 +44187,8 @@ function requireSafeBuffer () {
|
|
|
44193
44187
|
module.exports = buffer;
|
|
44194
44188
|
} else {
|
|
44195
44189
|
// Copy properties from require('buffer')
|
|
44196
|
-
copyProps(buffer, exports
|
|
44197
|
-
exports
|
|
44190
|
+
copyProps(buffer, exports);
|
|
44191
|
+
exports.Buffer = SafeBuffer;
|
|
44198
44192
|
}
|
|
44199
44193
|
|
|
44200
44194
|
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
@@ -47392,22 +47386,22 @@ var hasRequiredReadable;
|
|
|
47392
47386
|
function requireReadable () {
|
|
47393
47387
|
if (hasRequiredReadable) return readable.exports;
|
|
47394
47388
|
hasRequiredReadable = 1;
|
|
47395
|
-
(function (module, exports
|
|
47389
|
+
(function (module, exports) {
|
|
47396
47390
|
var Stream = require$$0$4;
|
|
47397
47391
|
if (process.env.READABLE_STREAM === 'disable' && Stream) {
|
|
47398
47392
|
module.exports = Stream.Readable;
|
|
47399
47393
|
Object.assign(module.exports, Stream);
|
|
47400
47394
|
module.exports.Stream = Stream;
|
|
47401
47395
|
} else {
|
|
47402
|
-
exports
|
|
47403
|
-
exports
|
|
47404
|
-
exports
|
|
47405
|
-
exports
|
|
47406
|
-
exports
|
|
47407
|
-
exports
|
|
47408
|
-
exports
|
|
47409
|
-
exports
|
|
47410
|
-
exports
|
|
47396
|
+
exports = module.exports = require_stream_readable();
|
|
47397
|
+
exports.Stream = Stream || exports;
|
|
47398
|
+
exports.Readable = exports;
|
|
47399
|
+
exports.Writable = require_stream_writable();
|
|
47400
|
+
exports.Duplex = require_stream_duplex();
|
|
47401
|
+
exports.Transform = require_stream_transform();
|
|
47402
|
+
exports.PassThrough = require_stream_passthrough();
|
|
47403
|
+
exports.finished = requireEndOfStream();
|
|
47404
|
+
exports.pipeline = requirePipeline();
|
|
47411
47405
|
}
|
|
47412
47406
|
} (readable, readable.exports));
|
|
47413
47407
|
return readable.exports;
|
|
@@ -48842,12 +48836,12 @@ var hasRequiredWebsocket;
|
|
|
48842
48836
|
function requireWebsocket () {
|
|
48843
48837
|
if (hasRequiredWebsocket) return websocket$1;
|
|
48844
48838
|
hasRequiredWebsocket = 1;
|
|
48845
|
-
(function (exports
|
|
48839
|
+
(function (exports) {
|
|
48846
48840
|
var __importDefault = (websocket$1 && websocket$1.__importDefault) || function (mod) {
|
|
48847
48841
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48848
48842
|
};
|
|
48849
|
-
Object.defineProperty(exports
|
|
48850
|
-
exports
|
|
48843
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48844
|
+
exports.AlpacaWebsocket = exports.ERROR = exports.CONN_ERROR = exports.EVENT = exports.STATE = void 0;
|
|
48851
48845
|
const events_1 = __importDefault(require$$0$1);
|
|
48852
48846
|
const ws_1 = __importDefault(requireWs());
|
|
48853
48847
|
const msgpack5_1 = __importDefault(requireMsgpack5());
|
|
@@ -48861,7 +48855,7 @@ function requireWebsocket () {
|
|
|
48861
48855
|
STATE["DISCONNECTED"] = "disconnected";
|
|
48862
48856
|
STATE["WAITING_TO_CONNECT"] = "waiting to connect";
|
|
48863
48857
|
STATE["WAITING_TO_RECONNECT"] = "waiting to reconnect";
|
|
48864
|
-
})(STATE || (exports
|
|
48858
|
+
})(STATE || (exports.STATE = STATE = {}));
|
|
48865
48859
|
// Client events
|
|
48866
48860
|
var EVENT;
|
|
48867
48861
|
(function (EVENT) {
|
|
@@ -48880,9 +48874,9 @@ function requireWebsocket () {
|
|
|
48880
48874
|
EVENT["CORRECTIONS"] = "corrections";
|
|
48881
48875
|
EVENT["ORDERBOOKS"] = "orderbooks";
|
|
48882
48876
|
EVENT["NEWS"] = "news";
|
|
48883
|
-
})(EVENT || (exports
|
|
48877
|
+
})(EVENT || (exports.EVENT = EVENT = {}));
|
|
48884
48878
|
// Connection errors by code
|
|
48885
|
-
exports
|
|
48879
|
+
exports.CONN_ERROR = new Map([
|
|
48886
48880
|
[400, "invalid syntax"],
|
|
48887
48881
|
[401, "not authenticated"],
|
|
48888
48882
|
[402, "auth failed"],
|
|
@@ -48901,7 +48895,7 @@ function requireWebsocket () {
|
|
|
48901
48895
|
ERROR["MISSING_SECERT_KEY"] = "missing secret key";
|
|
48902
48896
|
ERROR["MISSING_API_KEY"] = "missing api key";
|
|
48903
48897
|
ERROR["UNEXPECTED_MESSAGE"] = "unexpected message";
|
|
48904
|
-
})(ERROR || (exports
|
|
48898
|
+
})(ERROR || (exports.ERROR = ERROR = {}));
|
|
48905
48899
|
class AlpacaWebsocket extends events_1.default.EventEmitter {
|
|
48906
48900
|
constructor(options) {
|
|
48907
48901
|
super();
|
|
@@ -49058,7 +49052,7 @@ function requireWebsocket () {
|
|
|
49058
49052
|
this.updateSubscriptions(data[0]);
|
|
49059
49053
|
break;
|
|
49060
49054
|
case "error":
|
|
49061
|
-
this.emit(EVENT.CLIENT_ERROR, exports
|
|
49055
|
+
this.emit(EVENT.CLIENT_ERROR, exports.CONN_ERROR.get(data[0].code));
|
|
49062
49056
|
break;
|
|
49063
49057
|
default:
|
|
49064
49058
|
this.dataHandler(data);
|
|
@@ -49087,7 +49081,7 @@ function requireWebsocket () {
|
|
|
49087
49081
|
}
|
|
49088
49082
|
}
|
|
49089
49083
|
}
|
|
49090
|
-
exports
|
|
49084
|
+
exports.AlpacaWebsocket = AlpacaWebsocket;
|
|
49091
49085
|
} (websocket$1));
|
|
49092
49086
|
return websocket$1;
|
|
49093
49087
|
}
|
|
@@ -49721,8 +49715,8 @@ var hasRequiredWebsockets;
|
|
|
49721
49715
|
function requireWebsockets () {
|
|
49722
49716
|
if (hasRequiredWebsockets) return websockets;
|
|
49723
49717
|
hasRequiredWebsockets = 1;
|
|
49724
|
-
(function (exports
|
|
49725
|
-
Object.defineProperty(exports
|
|
49718
|
+
(function (exports) {
|
|
49719
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49726
49720
|
const events = require$$0$1;
|
|
49727
49721
|
const WebSocket = requireWs();
|
|
49728
49722
|
const entity = requireEntity();
|
|
@@ -49737,7 +49731,7 @@ function requireWebsockets () {
|
|
|
49737
49731
|
STATE.DISCONNECTED = "disconnected";
|
|
49738
49732
|
STATE.WAITING_TO_CONNECT = "waiting to connect";
|
|
49739
49733
|
STATE.WAITING_TO_RECONNECT = "waiting to reconnect";
|
|
49740
|
-
})((STATE = exports
|
|
49734
|
+
})((STATE = exports.STATE || (exports.STATE = {})));
|
|
49741
49735
|
// Client events
|
|
49742
49736
|
var EVENT;
|
|
49743
49737
|
(function (EVENT) {
|
|
@@ -49751,7 +49745,7 @@ function requireWebsockets () {
|
|
|
49751
49745
|
EVENT.STOCK_QUOTES = "stock_quotes";
|
|
49752
49746
|
EVENT.STOCK_AGG_SEC = "stock_agg_sec";
|
|
49753
49747
|
EVENT.STOCK_AGG_MIN = "stock_agg_min";
|
|
49754
|
-
})((EVENT = exports
|
|
49748
|
+
})((EVENT = exports.EVENT || (exports.EVENT = {})));
|
|
49755
49749
|
// Connection errors Each of these will also emit EVENT.ERROR
|
|
49756
49750
|
var ERROR;
|
|
49757
49751
|
(function (ERROR) {
|
|
@@ -49760,7 +49754,7 @@ function requireWebsockets () {
|
|
|
49760
49754
|
ERROR.MISSING_API_KEY = "missing api key";
|
|
49761
49755
|
ERROR.MISSING_SECRET_KEY = "missing secret key";
|
|
49762
49756
|
ERROR.UNKNOWN = "unknown error";
|
|
49763
|
-
})((ERROR = exports
|
|
49757
|
+
})((ERROR = exports.ERROR || (exports.ERROR = {})));
|
|
49764
49758
|
/**
|
|
49765
49759
|
* AlpacaStreamClient manages a connection to Alpaca's websocket api
|
|
49766
49760
|
*/
|
|
@@ -50073,7 +50067,7 @@ function requireWebsockets () {
|
|
|
50073
50067
|
}
|
|
50074
50068
|
}
|
|
50075
50069
|
}
|
|
50076
|
-
exports
|
|
50070
|
+
exports.AlpacaStreamClient = AlpacaStreamClient;
|
|
50077
50071
|
} (websockets));
|
|
50078
50072
|
return websockets;
|
|
50079
50073
|
}
|
|
@@ -50325,13 +50319,13 @@ var hasRequiredDist;
|
|
|
50325
50319
|
function requireDist () {
|
|
50326
50320
|
if (hasRequiredDist) return dist$1.exports;
|
|
50327
50321
|
hasRequiredDist = 1;
|
|
50328
|
-
(function (module, exports
|
|
50322
|
+
(function (module, exports) {
|
|
50329
50323
|
var __importDefault = (dist && dist.__importDefault) || function (mod) {
|
|
50330
50324
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50331
50325
|
};
|
|
50332
|
-
Object.defineProperty(exports
|
|
50326
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50333
50327
|
const alpaca_trade_api_1 = __importDefault(requireAlpacaTradeApi());
|
|
50334
|
-
exports
|
|
50328
|
+
exports.default = alpaca_trade_api_1.default;
|
|
50335
50329
|
module.exports = alpaca_trade_api_1.default;
|
|
50336
50330
|
} (dist$1, dist$1.exports));
|
|
50337
50331
|
return dist$1.exports;
|