@riocrypto/common-server 1.0.2481 → 1.0.2484
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fiat, Crypto, Side, TWAPSessionStatus, Country } from "@riocrypto/common";
|
|
2
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
+
interface TWAPSessionAttrs {
|
|
4
|
+
createdAt: Date;
|
|
5
|
+
userId: string;
|
|
6
|
+
country: Country;
|
|
7
|
+
status: TWAPSessionStatus;
|
|
8
|
+
side: Side;
|
|
9
|
+
crypto: Crypto;
|
|
10
|
+
fiat: Fiat;
|
|
11
|
+
amountToTrade: number;
|
|
12
|
+
amountTraded: number;
|
|
13
|
+
amountRemaining: number;
|
|
14
|
+
tradeCurrency: Fiat | Crypto;
|
|
15
|
+
spread: number;
|
|
16
|
+
clipSize: number;
|
|
17
|
+
interval: number;
|
|
18
|
+
isRunning: boolean;
|
|
19
|
+
lastRanAt?: Date;
|
|
20
|
+
}
|
|
21
|
+
interface TWAPSessionModel extends Model<TWAPSessionDoc> {
|
|
22
|
+
build(attrs: TWAPSessionAttrs): TWAPSessionDoc;
|
|
23
|
+
}
|
|
24
|
+
interface TWAPSessionDoc extends Document {
|
|
25
|
+
id: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
country: Country;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
status: TWAPSessionStatus;
|
|
30
|
+
side: Side;
|
|
31
|
+
crypto: Crypto;
|
|
32
|
+
fiat: Fiat;
|
|
33
|
+
amountToTrade: number;
|
|
34
|
+
amountTraded: number;
|
|
35
|
+
amountRemaining: number;
|
|
36
|
+
tradeCurrency: Fiat | Crypto;
|
|
37
|
+
spread: number;
|
|
38
|
+
clipSize: number;
|
|
39
|
+
interval: number;
|
|
40
|
+
isRunning: boolean;
|
|
41
|
+
lastRanAt?: Date;
|
|
42
|
+
}
|
|
43
|
+
declare const buildTWAPSession: (mongoose: Mongoose) => TWAPSessionModel;
|
|
44
|
+
export { buildTWAPSession, TWAPSessionDoc, TWAPSessionAttrs };
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
userId: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
country: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
status: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
side: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
crypto: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
fiat: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
amountToTrade: {
|
|
38
|
+
type: Number,
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
amountTraded: {
|
|
42
|
+
type: Number,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
amountRemaining: {
|
|
46
|
+
type: Number,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
tradeCurrency: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
spread: {
|
|
54
|
+
type: Number,
|
|
55
|
+
required: true,
|
|
56
|
+
},
|
|
57
|
+
clipSize: {
|
|
58
|
+
type: Number,
|
|
59
|
+
required: true,
|
|
60
|
+
},
|
|
61
|
+
interval: {
|
|
62
|
+
type: Number,
|
|
63
|
+
required: true,
|
|
64
|
+
},
|
|
65
|
+
isRunning: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
required: true,
|
|
68
|
+
},
|
|
69
|
+
lastRanAt: {
|
|
70
|
+
type: Date,
|
|
71
|
+
},
|
|
72
|
+
}, {
|
|
73
|
+
toJSON: {
|
|
74
|
+
transform(doc, ret) {
|
|
75
|
+
ret.id = ret._id.valueOf();
|
|
76
|
+
delete ret._id;
|
|
77
|
+
delete ret.__v;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
TWAPSessionSchema.statics.build = (attrs) => {
|
|
82
|
+
return new TWAPSession(attrs);
|
|
83
|
+
};
|
|
84
|
+
const TWAPSession = mongoose.model("TWAPSession", TWAPSessionSchema);
|
|
85
|
+
return TWAPSession;
|
|
86
|
+
};
|
|
87
|
+
exports.buildTWAPSession = buildTWAPSession;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2484",
|
|
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.
|
|
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",
|