@riocrypto/common-server 1.0.2481 → 1.0.2483

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/build/index.d.ts CHANGED
@@ -94,6 +94,7 @@ export * from "./models/liquidity-reservation";
94
94
  export * from "./models/axe-slack-thread";
95
95
  export * from "./models/axe-telegram-thread";
96
96
  export * from "./models/auth-activity-slack-thread";
97
+ export * from "./models/twap-session";
97
98
  export * from "./clients/axios-with-logging";
98
99
  export * from "./clients/slack-client";
99
100
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -110,6 +110,7 @@ __exportStar(require("./models/liquidity-reservation"), exports);
110
110
  __exportStar(require("./models/axe-slack-thread"), exports);
111
111
  __exportStar(require("./models/axe-telegram-thread"), exports);
112
112
  __exportStar(require("./models/auth-activity-slack-thread"), exports);
113
+ __exportStar(require("./models/twap-session"), exports);
113
114
  __exportStar(require("./clients/axios-with-logging"), exports);
114
115
  __exportStar(require("./clients/slack-client"), exports);
115
116
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -72,6 +72,16 @@ interface RioSettingsAttrs {
72
72
  dates: string[];
73
73
  };
74
74
  };
75
+ defaultTWAPSettings: {
76
+ [key in Fiat]?: {
77
+ [key in Side]: {
78
+ isEnabled: boolean;
79
+ spread: number;
80
+ minClipSize: number;
81
+ interval: number;
82
+ };
83
+ };
84
+ };
75
85
  }
76
86
  interface RioSettingsDoc extends mongoose.Document {
77
87
  platformFee: number;
@@ -144,6 +154,16 @@ interface RioSettingsDoc extends mongoose.Document {
144
154
  dates: string[];
145
155
  };
146
156
  };
157
+ defaultTWAPSettings: {
158
+ [key in Fiat]?: {
159
+ [key in Side]: {
160
+ isEnabled: boolean;
161
+ spread: number;
162
+ minClipSize: number;
163
+ interval: number;
164
+ };
165
+ };
166
+ };
147
167
  }
148
168
  interface RioSettingsModel extends mongoose.Model<RioSettingsDoc> {
149
169
  build(attrs: RioSettingsAttrs): RioSettingsDoc;
@@ -66,6 +66,9 @@ const buildRioSettings = (mongoose) => {
66
66
  holidays: {
67
67
  type: Object,
68
68
  },
69
+ defaultTWAPSettings: {
70
+ type: Object,
71
+ },
69
72
  }, {
70
73
  toJSON: {
71
74
  transform(doc, ret) {
@@ -0,0 +1,38 @@
1
+ import { Fiat, Crypto, Side, TWAPSessionStatus } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface TWAPSessionAttrs {
4
+ createdAt: Date;
5
+ status: TWAPSessionStatus;
6
+ side: Side;
7
+ crypto: Crypto;
8
+ fiat: Fiat;
9
+ amountToTrade: number;
10
+ amountTraded: number;
11
+ amountRemaining: number;
12
+ tradeCurrency: Fiat | Crypto;
13
+ spread: number;
14
+ clipSize: number;
15
+ interval: number;
16
+ isRunning: boolean;
17
+ }
18
+ interface TWAPSessionModel extends Model<TWAPSessionDoc> {
19
+ build(attrs: TWAPSessionAttrs): TWAPSessionDoc;
20
+ }
21
+ interface TWAPSessionDoc extends Document {
22
+ id: string;
23
+ createdAt: Date;
24
+ status: TWAPSessionStatus;
25
+ side: Side;
26
+ crypto: Crypto;
27
+ fiat: Fiat;
28
+ amountToTrade: number;
29
+ amountTraded: number;
30
+ amountRemaining: number;
31
+ tradeCurrency: Fiat | Crypto;
32
+ spread: number;
33
+ clipSize: number;
34
+ interval: number;
35
+ isRunning: boolean;
36
+ }
37
+ declare const buildTWAPSession: (mongoose: Mongoose) => TWAPSessionModel;
38
+ export { buildTWAPSession, TWAPSessionDoc, TWAPSessionAttrs };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTWAPSession = void 0;
4
+ const buildTWAPSession = (mongoose) => {
5
+ if (mongoose.models.TWAPSession) {
6
+ return mongoose.model("TWAPSession");
7
+ }
8
+ const TWAPSessionSchema = new mongoose.Schema({
9
+ createdAt: {
10
+ type: Date,
11
+ required: true,
12
+ },
13
+ status: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ side: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ crypto: {
22
+ type: String,
23
+ required: true,
24
+ },
25
+ fiat: {
26
+ type: String,
27
+ required: true,
28
+ },
29
+ amountToTrade: {
30
+ type: Number,
31
+ required: true,
32
+ },
33
+ amountTraded: {
34
+ type: Number,
35
+ required: true,
36
+ },
37
+ amountRemaining: {
38
+ type: Number,
39
+ required: true,
40
+ },
41
+ tradeCurrency: {
42
+ type: String,
43
+ required: true,
44
+ },
45
+ spread: {
46
+ type: Number,
47
+ required: true,
48
+ },
49
+ clipSize: {
50
+ type: Number,
51
+ required: true,
52
+ },
53
+ interval: {
54
+ type: Number,
55
+ required: true,
56
+ },
57
+ isRunning: {
58
+ type: Boolean,
59
+ required: true,
60
+ },
61
+ }, {
62
+ toJSON: {
63
+ transform(doc, ret) {
64
+ ret.id = ret._id.valueOf();
65
+ delete ret._id;
66
+ delete ret.__v;
67
+ },
68
+ },
69
+ });
70
+ TWAPSessionSchema.statics.build = (attrs) => {
71
+ return new TWAPSession(attrs);
72
+ };
73
+ const TWAPSession = mongoose.model("TWAPSession", TWAPSessionSchema);
74
+ return TWAPSession;
75
+ };
76
+ exports.buildTWAPSession = buildTWAPSession;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2481",
3
+ "version": "1.0.2483",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.2249",
31
+ "@riocrypto/common": "^1.0.2250",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",