@riocrypto/common-server 1.0.2676 → 1.0.2678

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
@@ -104,6 +104,9 @@ export * from "./models/transnetwork-fx-trade";
104
104
  export * from "./models/inbound-bank-deposit";
105
105
  export * from "./models/inbound-crypto-deposit";
106
106
  export * from "./models/order-log";
107
+ export * from "./models/position";
108
+ export * from "./models/fill";
109
+ export * from "./models/residual";
107
110
  export * from "./models/approved-alternative-bank-account-holder-name";
108
111
  export * from "./models/liquidity-sourcing-plan";
109
112
  export * from "./models/liquidity-sourcing-exclusion";
package/build/index.js CHANGED
@@ -120,6 +120,9 @@ __exportStar(require("./models/transnetwork-fx-trade"), exports);
120
120
  __exportStar(require("./models/inbound-bank-deposit"), exports);
121
121
  __exportStar(require("./models/inbound-crypto-deposit"), exports);
122
122
  __exportStar(require("./models/order-log"), exports);
123
+ __exportStar(require("./models/position"), exports);
124
+ __exportStar(require("./models/fill"), exports);
125
+ __exportStar(require("./models/residual"), exports);
123
126
  __exportStar(require("./models/approved-alternative-bank-account-holder-name"), exports);
124
127
  __exportStar(require("./models/liquidity-sourcing-plan"), exports);
125
128
  __exportStar(require("./models/liquidity-sourcing-exclusion"), exports);
@@ -0,0 +1,39 @@
1
+ import { Side } from "@riocrypto/common/build/types/side";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface FillAttrs {
4
+ createdAt: Date;
5
+ effectiveDate: Date;
6
+ orderId: string;
7
+ symbol: string;
8
+ status: string;
9
+ side: Side;
10
+ price: number;
11
+ qty: number;
12
+ source: string;
13
+ isFakeFill: boolean;
14
+ isDeleted: boolean;
15
+ note?: string;
16
+ referenceRate?: number;
17
+ valueDate?: Date;
18
+ }
19
+ interface FillDoc extends Document {
20
+ createdAt: Date;
21
+ effectiveDate: Date;
22
+ orderId: string;
23
+ symbol: string;
24
+ status: string;
25
+ side: Side;
26
+ price: number;
27
+ qty: number;
28
+ source: string;
29
+ isFakeFill: boolean;
30
+ isDeleted: boolean;
31
+ note?: string;
32
+ referenceRate?: number;
33
+ valueDate?: Date;
34
+ }
35
+ interface FillModel extends Model<FillDoc> {
36
+ build(attrs: FillAttrs): FillDoc;
37
+ }
38
+ declare const buildFill: (mongoose: Mongoose) => FillModel;
39
+ export { buildFill, FillDoc, FillAttrs };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildFill = void 0;
4
+ const buildFill = (mongoose) => {
5
+ if (mongoose.models.Fill) {
6
+ return mongoose.model("Fill");
7
+ }
8
+ const FillSchema = new mongoose.Schema({
9
+ createdAt: { type: Date, required: true },
10
+ effectiveDate: { type: Date, required: true },
11
+ orderId: { type: String, required: true },
12
+ symbol: { type: String, required: true },
13
+ status: { type: String, required: true },
14
+ side: { type: String, required: true },
15
+ price: { type: Number, required: true },
16
+ qty: { type: Number, required: true },
17
+ source: { type: String, required: true },
18
+ isFakeFill: { type: Boolean, required: true, default: false },
19
+ isDeleted: { type: Boolean, required: true, default: false },
20
+ note: { type: String, required: false },
21
+ referenceRate: { type: Number, required: false },
22
+ valueDate: { type: Date, required: false }
23
+ });
24
+ FillSchema.index({ createdAt: -1 });
25
+ FillSchema.index({ orderId: -1 });
26
+ FillSchema.index({ source: 1, createdAt: -1 });
27
+ FillSchema.statics.build = (attrs) => {
28
+ return new Fill(attrs);
29
+ };
30
+ const Fill = mongoose.model("Fill", FillSchema);
31
+ return Fill;
32
+ };
33
+ exports.buildFill = buildFill;
@@ -13,6 +13,7 @@ interface LiquiditySourcingPlanAttrs {
13
13
  currentStepIndex: number;
14
14
  steps: LiquiditySourcingStep[];
15
15
  amountSourced?: number;
16
+ isCronProcessing?: boolean;
16
17
  }
17
18
  interface LiquiditySourcingPlanDoc extends mongoose.Document, Omit<LiquiditySourcingPlan, "id"> {
18
19
  id: string;
@@ -52,6 +52,7 @@ const LiquiditySourcingPlanSchema = new mongoose_1.default.Schema({
52
52
  currentStepIndex: { type: Number, required: true },
53
53
  steps: { type: [StepSchema], required: true },
54
54
  amountSourced: { type: Number },
55
+ isCronProcessing: { type: Boolean, default: false },
55
56
  }, {
56
57
  toJSON: {
57
58
  transform(doc, ret) {
@@ -1,11 +1,4 @@
1
1
  import { Mongoose, Model, Document } from "mongoose";
2
- interface OrderLog {
3
- createdAt: Date;
4
- orderId: string;
5
- status: string;
6
- message?: string;
7
- isReset: boolean;
8
- }
9
2
  interface OrderLogAttrs {
10
3
  createdAt: Date;
11
4
  orderId: string;
@@ -21,7 +14,7 @@ interface OrderLogDoc extends Document {
21
14
  isReset: boolean;
22
15
  }
23
16
  interface OrderLogModel extends Model<OrderLogDoc> {
24
- build(attrs: OrderLog): OrderLogDoc;
17
+ build(attrs: OrderLogAttrs): OrderLogDoc;
25
18
  }
26
19
  declare const buildOrderLog: (mongoose: Mongoose) => OrderLogModel;
27
20
  export { buildOrderLog, OrderLogDoc, OrderLogAttrs };
@@ -5,7 +5,7 @@ const buildOrderLog = (mongoose) => {
5
5
  if (mongoose.models.OrderLog) {
6
6
  return mongoose.model("OrderLog");
7
7
  }
8
- var schema = new mongoose.Schema({
8
+ const schema = new mongoose.Schema({
9
9
  createdAt: { type: Date, required: true },
10
10
  orderId: { type: String, required: true },
11
11
  status: { type: String, required: true },
@@ -0,0 +1,33 @@
1
+ import { Side } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface PositionAttrs {
4
+ symbol: string;
5
+ side: Side;
6
+ baseQty: number;
7
+ quoteQty: number;
8
+ averagePrice: number;
9
+ openPnL: number;
10
+ closedPnL: number;
11
+ lastPrice: number;
12
+ valueDate?: Date;
13
+ averageReferenceRate?: number;
14
+ instrumentType?: string;
15
+ }
16
+ interface PositionDoc extends Document {
17
+ symbol: string;
18
+ side: Side;
19
+ baseQty: number;
20
+ quoteQty: number;
21
+ averagePrice: number;
22
+ openPnL: number;
23
+ closedPnL: number;
24
+ lastPrice: number;
25
+ valueDate?: Date;
26
+ averageReferenceRate?: number;
27
+ instrumentType?: string;
28
+ }
29
+ interface PositionModel extends Model<PositionDoc> {
30
+ build(attrs: PositionAttrs): PositionDoc;
31
+ }
32
+ declare const buildPosition: (mongoose: Mongoose) => PositionModel;
33
+ export { buildPosition, PositionDoc, PositionAttrs };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPosition = void 0;
4
+ const buildPosition = (mongoose) => {
5
+ if (mongoose.models.Position) {
6
+ return mongoose.model("Position");
7
+ }
8
+ const PositionSchema = new mongoose.Schema({
9
+ createdAt: { type: Date, required: true },
10
+ symbol: { type: String, required: true },
11
+ side: { type: String, required: true },
12
+ baseQty: { type: Number, required: true },
13
+ quoteQty: { type: Number, required: true },
14
+ averagePrice: { type: Number, required: true },
15
+ openPnL: { type: Number, required: true },
16
+ closedPnL: { type: Number, required: true },
17
+ lastPrice: { type: Number, required: true },
18
+ valueDate: { type: Date, required: false },
19
+ averageReferenceRate: { type: Number, required: false },
20
+ instrumentType: { type: String, required: false }
21
+ });
22
+ PositionSchema.index({ symbol: -1 });
23
+ PositionSchema.statics.build = (attrs) => {
24
+ return new Position(attrs);
25
+ };
26
+ const Position = mongoose.model("Position", PositionSchema);
27
+ return Position;
28
+ };
29
+ exports.buildPosition = buildPosition;
@@ -0,0 +1,21 @@
1
+ import { Side } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface ResidualAttrs {
4
+ symbol: string;
5
+ side: Side;
6
+ quantity: number;
7
+ tenor: string;
8
+ valueDate: Date;
9
+ }
10
+ interface ResidualDoc extends Document {
11
+ symbol: string;
12
+ side: Side;
13
+ quantity: number;
14
+ tenor: string;
15
+ valueDate: Date;
16
+ }
17
+ interface ResidualModel extends Model<ResidualDoc> {
18
+ build(attrs: ResidualAttrs): ResidualDoc;
19
+ }
20
+ declare const buildResidual: (mongoose: Mongoose) => ResidualModel;
21
+ export { buildResidual, ResidualDoc, ResidualAttrs };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildResidual = void 0;
4
+ const buildResidual = (mongoose) => {
5
+ if (mongoose.models.Residual) {
6
+ return mongoose.model("Residual");
7
+ }
8
+ const ResidualSchema = new mongoose.Schema({
9
+ createdAt: { type: Date, required: true },
10
+ symbol: { type: String, required: true },
11
+ side: { type: String, required: true },
12
+ quantity: { type: Number, required: true },
13
+ tenor: { type: String, required: true },
14
+ valueDate: { type: Date, required: true }
15
+ });
16
+ ResidualSchema.index({ symbol: -1 });
17
+ ResidualSchema.statics.build = (attrs) => {
18
+ return new Residual(attrs);
19
+ };
20
+ const Residual = mongoose.model("Residual", ResidualSchema);
21
+ return Residual;
22
+ };
23
+ exports.buildResidual = buildResidual;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2676",
3
+ "version": "1.0.2678",
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.2471",
31
+ "@riocrypto/common": "^1.0.2472",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",