@riocrypto/common-server 1.0.1744 → 1.0.1745
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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Fiat, Crypto } from "@riocrypto/common";
|
|
2
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
+
interface ArbitrageOpportunityAttrs {
|
|
4
|
+
recipe: "BuyUSDTAtBitsoSellUSDAtBBVA";
|
|
5
|
+
minProfit: {
|
|
6
|
+
value: number;
|
|
7
|
+
currency: Crypto | Fiat;
|
|
8
|
+
};
|
|
9
|
+
amountAvailableToTrade: {
|
|
10
|
+
value: number;
|
|
11
|
+
currency: Fiat | Crypto;
|
|
12
|
+
lastUpdated: Date;
|
|
13
|
+
frozen?: boolean;
|
|
14
|
+
};
|
|
15
|
+
expectedProfit: {
|
|
16
|
+
value: number;
|
|
17
|
+
currency: Crypto | Fiat;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface ArbitrageOpportunityModel extends Model<ArbitrageOpportunityDoc> {
|
|
21
|
+
build(attrs: ArbitrageOpportunityAttrs): ArbitrageOpportunityDoc;
|
|
22
|
+
}
|
|
23
|
+
interface ArbitrageOpportunityDoc extends Document {
|
|
24
|
+
_id: string;
|
|
25
|
+
recipe: "BuyUSDTAtBitsoSellUSDAtBBVA";
|
|
26
|
+
minProfit: {
|
|
27
|
+
value: number;
|
|
28
|
+
currency: Crypto | Fiat;
|
|
29
|
+
};
|
|
30
|
+
amountAvailableToTrade: {
|
|
31
|
+
value: number;
|
|
32
|
+
currency: Fiat | Crypto;
|
|
33
|
+
lastUpdated: Date;
|
|
34
|
+
frozen?: boolean;
|
|
35
|
+
};
|
|
36
|
+
expectedProfit: {
|
|
37
|
+
value: number;
|
|
38
|
+
currency: Crypto | Fiat;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
declare const buildArbitrageOpportunity: (mongoose: Mongoose) => ArbitrageOpportunityModel;
|
|
42
|
+
export { buildArbitrageOpportunity, ArbitrageOpportunityDoc, ArbitrageOpportunityAttrs, };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildArbitrageOpportunity = void 0;
|
|
4
|
+
const buildArbitrageOpportunity = (mongoose) => {
|
|
5
|
+
if (mongoose.models.ArbitrageOpportunity) {
|
|
6
|
+
return mongoose.model("ArbitrageOpportunity");
|
|
7
|
+
}
|
|
8
|
+
const ArbitrageOpportunitySchema = new mongoose.Schema({
|
|
9
|
+
recipe: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
minProfit: {
|
|
14
|
+
value: {
|
|
15
|
+
type: Number,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
currency: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
amountAvailableToTrade: {
|
|
24
|
+
value: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
currency: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
lastUpdated: {
|
|
33
|
+
type: Date,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
frozen: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
expectedProfit: {
|
|
41
|
+
value: {
|
|
42
|
+
type: Number,
|
|
43
|
+
required: true,
|
|
44
|
+
},
|
|
45
|
+
currency: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}, {
|
|
51
|
+
toJSON: {
|
|
52
|
+
transform(doc, ret) {
|
|
53
|
+
ret.id = ret._id.valueOf();
|
|
54
|
+
delete ret._id;
|
|
55
|
+
delete ret.__v;
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
ArbitrageOpportunitySchema.statics.build = (attrs) => {
|
|
60
|
+
return new ArbitrageOpportunity(attrs);
|
|
61
|
+
};
|
|
62
|
+
const ArbitrageOpportunity = mongoose.model("ArbitrageOpportunity", ArbitrageOpportunitySchema);
|
|
63
|
+
return ArbitrageOpportunity;
|
|
64
|
+
};
|
|
65
|
+
exports.buildArbitrageOpportunity = buildArbitrageOpportunity;
|
|
@@ -3,7 +3,7 @@ import { Mongoose, Model, Document } from "mongoose";
|
|
|
3
3
|
interface ArbitrageSettingsAttrs {
|
|
4
4
|
BuyUSDTAtBitsoSellUSDAtBBVA: {
|
|
5
5
|
active: boolean;
|
|
6
|
-
|
|
6
|
+
minProfit: {
|
|
7
7
|
value: number;
|
|
8
8
|
currency: Crypto | Fiat;
|
|
9
9
|
};
|
|
@@ -13,6 +13,10 @@ interface ArbitrageSettingsAttrs {
|
|
|
13
13
|
lastUpdated: Date;
|
|
14
14
|
frozen?: boolean;
|
|
15
15
|
};
|
|
16
|
+
lastOpportunity?: {
|
|
17
|
+
id: string;
|
|
18
|
+
date: Date;
|
|
19
|
+
};
|
|
16
20
|
};
|
|
17
21
|
}
|
|
18
22
|
interface ArbitrageSettingsModel extends Model<ArbitrageSettingsDoc> {
|
|
@@ -22,7 +26,7 @@ interface ArbitrageSettingsDoc extends Document {
|
|
|
22
26
|
_id: string;
|
|
23
27
|
BuyUSDTAtBitsoSellUSDAtBBVA: {
|
|
24
28
|
active: boolean;
|
|
25
|
-
|
|
29
|
+
minProfit: {
|
|
26
30
|
value: number;
|
|
27
31
|
currency: Crypto | Fiat;
|
|
28
32
|
};
|
|
@@ -32,6 +36,10 @@ interface ArbitrageSettingsDoc extends Document {
|
|
|
32
36
|
lastUpdated: Date;
|
|
33
37
|
frozen?: boolean;
|
|
34
38
|
};
|
|
39
|
+
lastOpportunity?: {
|
|
40
|
+
id: string;
|
|
41
|
+
date: Date;
|
|
42
|
+
};
|
|
35
43
|
};
|
|
36
44
|
}
|
|
37
45
|
declare const buildArbitrageSettings: (mongoose: Mongoose) => ArbitrageSettingsModel;
|
|
@@ -11,7 +11,7 @@ const buildArbitrageSettings = (mongoose) => {
|
|
|
11
11
|
type: Boolean,
|
|
12
12
|
required: true,
|
|
13
13
|
},
|
|
14
|
-
|
|
14
|
+
minProfit: {
|
|
15
15
|
value: {
|
|
16
16
|
type: Number,
|
|
17
17
|
required: true,
|
|
@@ -39,6 +39,14 @@ const buildArbitrageSettings = (mongoose) => {
|
|
|
39
39
|
default: false,
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
+
lastOpportunity: {
|
|
43
|
+
id: {
|
|
44
|
+
type: String,
|
|
45
|
+
},
|
|
46
|
+
date: {
|
|
47
|
+
type: Date,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
42
50
|
},
|
|
43
51
|
}, {
|
|
44
52
|
toJSON: {
|