@steerprotocol/app-loader 0.0.7 → 0.0.8

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/lib/index.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ export declare class RawTradeData {
2
+ timestamp: number;
3
+ price: number;
4
+ volume: number;
5
+ constructor(timestamp: number, price: number, volume: number);
6
+ }
1
7
  export declare class Candle {
2
8
  timestamp: number;
3
9
  high: number;
@@ -38,9 +44,5 @@ export type WasmModule = {
38
44
  transform: typeof transform;
39
45
  memory: WebAssembly.Memory;
40
46
  };
41
- export type TickData = {
42
- index: number;
43
- value: string;
44
- };
45
47
  export declare const loadWasm: (input: string | ArrayBuffer, imports?: {}) => Promise<WasmModule>;
46
48
  export {};
package/lib/index.js CHANGED
@@ -32,9 +32,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.loadWasm = exports.Candle = void 0;
35
+ exports.loadWasm = exports.Candle = exports.RawTradeData = void 0;
36
36
  const pondjs_1 = require("pondjs");
37
37
  const types_1 = require("pondjs/lib/types");
38
+ class RawTradeData {
39
+ constructor(timestamp, price, volume) {
40
+ this.timestamp = timestamp;
41
+ this.price = price;
42
+ this.volume = volume;
43
+ }
44
+ }
45
+ exports.RawTradeData = RawTradeData;
38
46
  class Candle {
39
47
  constructor(timestamp, high, low, open, close, volume) {
40
48
  this.timestamp = timestamp;
@@ -212,7 +220,7 @@ function instantiate(module, imports = {}) {
212
220
  return [];
213
221
  }
214
222
  const series = (0, pondjs_1.timeSeries)({
215
- name: 'swaps',
223
+ name: 'candles',
216
224
  columns: [...Object.keys(data[0])],
217
225
  points: data.map((point) => {
218
226
  return [...Object.values(point)].map(value => Number(value));
@@ -222,10 +230,11 @@ function instantiate(module, imports = {}) {
222
230
  .fixedWindowRollup({
223
231
  window: (0, pondjs_1.window)((0, pondjs_1.duration)(candleSize)),
224
232
  aggregation: {
225
- high: ['value', (0, pondjs_1.max)()],
226
- low: ['value', (0, pondjs_1.min)()],
227
- close: ['value', (0, pondjs_1.last)()],
228
- open: ['value', (0, pondjs_1.first)()],
233
+ high: ['price', (0, pondjs_1.max)()],
234
+ low: ['price', (0, pondjs_1.min)()],
235
+ close: ['price', (0, pondjs_1.last)()],
236
+ open: ['price', (0, pondjs_1.first)()],
237
+ volume: ['volume', (0, pondjs_1.sum)()],
229
238
  },
230
239
  })
231
240
  .fill({
@@ -256,6 +265,7 @@ function instantiate(module, imports = {}) {
256
265
  low: p[2],
257
266
  close: p[3],
258
267
  open: p[4],
268
+ volume: p[5],
259
269
  };
260
270
  });
261
271
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@steerprotocol/app-loader",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "App Loader for Steer Protocol",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc --build tsconfig.json",
8
+ "build": "tsc",
9
9
  "format": "prettier --write \"src/**/*.(js|ts)\"",
10
10
  "lint": "eslint src --ext .js,.ts",
11
11
  "lint:fix": "eslint src --fix --ext .js,.ts",
@@ -1,7 +0,0 @@
1
- /// <reference types="node" />
2
- import crypto from 'node:crypto';
3
- export declare class Uuid {
4
- v4(options?: crypto.RandomUUIDOptions | undefined): string;
5
- }
6
- declare const _default: Uuid;
7
- export default _default;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Uuid = void 0;
7
- const node_crypto_1 = __importDefault(require("node:crypto"));
8
- class Uuid {
9
- v4(options) {
10
- return node_crypto_1.default.randomUUID(options);
11
- }
12
- }
13
- exports.Uuid = Uuid;
14
- exports.default = new Uuid();