@riocrypto/common-server 1.0.2742 → 1.0.2744

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
@@ -123,6 +123,7 @@ export * from "./models/binance-rfq-trade";
123
123
  export * from "./models/static-bank-payment-reference";
124
124
  export * from "./models/indicative-quote-page";
125
125
  export * from "./models/indicative-quote-page-verification";
126
+ export * from "./models/cancelled-order-pnl-report";
126
127
  export * from "./clients/axios-with-logging";
127
128
  export * from "./clients/slack-client";
128
129
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -139,6 +139,7 @@ __exportStar(require("./models/binance-rfq-trade"), exports);
139
139
  __exportStar(require("./models/static-bank-payment-reference"), exports);
140
140
  __exportStar(require("./models/indicative-quote-page"), exports);
141
141
  __exportStar(require("./models/indicative-quote-page-verification"), exports);
142
+ __exportStar(require("./models/cancelled-order-pnl-report"), exports);
142
143
  __exportStar(require("./clients/axios-with-logging"), exports);
143
144
  __exportStar(require("./clients/slack-client"), exports);
144
145
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -10,6 +10,7 @@ interface BinanceRFQQuoteAttrs {
10
10
  side: BinanceRFQSide;
11
11
  price: number;
12
12
  quantity: number;
13
+ quoteOrderQty: number;
13
14
  settleTime: number;
14
15
  status: BinanceRFQQuoteStatus;
15
16
  }
@@ -23,6 +24,7 @@ interface BinanceRFQQuoteDoc extends Document {
23
24
  side: BinanceRFQSide;
24
25
  price: number;
25
26
  quantity: number;
27
+ quoteOrderQty: number;
26
28
  settleTime: number;
27
29
  status: BinanceRFQQuoteStatus;
28
30
  createdAt: Date;
@@ -43,6 +43,10 @@ const buildBinanceRFQQuote = (mongoose) => {
43
43
  type: Number,
44
44
  required: true,
45
45
  },
46
+ quoteOrderQty: {
47
+ type: Number,
48
+ default: 0,
49
+ },
46
50
  settleTime: {
47
51
  type: Number,
48
52
  required: true,
@@ -0,0 +1,21 @@
1
+ import { CancelledOrderPnlEntry, CancelledOrderPnlReport } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface CancelledOrderPnlReportAttrs extends Omit<CancelledOrderPnlReport, "id"> {
4
+ }
5
+ interface CancelledOrderPnlReportDoc extends Document {
6
+ userId: CancelledOrderPnlReport["userId"];
7
+ year: CancelledOrderPnlReport["year"];
8
+ month: CancelledOrderPnlReport["month"];
9
+ entries: CancelledOrderPnlEntry[];
10
+ grossGain: CancelledOrderPnlReport["grossGain"];
11
+ grossLoss: CancelledOrderPnlReport["grossLoss"];
12
+ netPnl: CancelledOrderPnlReport["netPnl"];
13
+ uploadedBy: CancelledOrderPnlReport["uploadedBy"];
14
+ createdAt: CancelledOrderPnlReport["createdAt"];
15
+ updatedAt: CancelledOrderPnlReport["updatedAt"];
16
+ }
17
+ interface CancelledOrderPnlReportModel extends Model<CancelledOrderPnlReportDoc> {
18
+ build(attrs: CancelledOrderPnlReportAttrs): CancelledOrderPnlReportDoc;
19
+ }
20
+ declare const buildCancelledOrderPnlReport: (mongoose: Mongoose) => CancelledOrderPnlReportModel;
21
+ export { buildCancelledOrderPnlReport, CancelledOrderPnlReportDoc, CancelledOrderPnlReportAttrs, };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCancelledOrderPnlReport = void 0;
4
+ const buildCancelledOrderPnlReport = (mongoose) => {
5
+ if (mongoose.models.CancelledOrderPnlReport) {
6
+ return mongoose.model("CancelledOrderPnlReport");
7
+ }
8
+ const entrySchema = new mongoose.Schema({
9
+ orderId: { type: String, required: true },
10
+ hedgePrice: { type: Number, required: true },
11
+ counterHedgePrice: { type: Number, required: true },
12
+ side: { type: String, required: true },
13
+ crypto: { type: String, required: true },
14
+ fiat: { type: String, required: true },
15
+ amountFiat: { type: Number, required: true },
16
+ amountCrypto: { type: Number, required: true },
17
+ pnl: { type: Number, required: true },
18
+ }, { _id: false });
19
+ const reportSchema = new mongoose.Schema({
20
+ userId: { type: String, required: true },
21
+ year: { type: Number, required: true },
22
+ month: { type: Number, required: true },
23
+ entries: { type: [entrySchema], required: true },
24
+ grossGain: { type: Number, required: true },
25
+ grossLoss: { type: Number, required: true },
26
+ netPnl: { type: Number, required: true },
27
+ uploadedBy: { type: String, required: true },
28
+ createdAt: { type: Date, required: true },
29
+ updatedAt: { type: Date, required: true },
30
+ }, {
31
+ toJSON: {
32
+ transform(_doc, ret) {
33
+ ret.id = ret._id;
34
+ delete ret._id;
35
+ delete ret.__v;
36
+ },
37
+ },
38
+ });
39
+ reportSchema.index({ userId: 1, year: -1, month: -1 }, { unique: true });
40
+ reportSchema.statics.build = (attrs) => {
41
+ return new CancelledOrderPnlReport(attrs);
42
+ };
43
+ const CancelledOrderPnlReport = mongoose.model("CancelledOrderPnlReport", reportSchema);
44
+ return CancelledOrderPnlReport;
45
+ };
46
+ exports.buildCancelledOrderPnlReport = buildCancelledOrderPnlReport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2742",
3
+ "version": "1.0.2744",
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.2534",
31
+ "@riocrypto/common": "^1.0.2536",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",