@volare.finance/nestjs.plugins 1.1.6 → 1.1.8
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/README.md +13 -0
- package/dist/decorators/api.empty.response.decorator.d.ts +5 -0
- package/dist/decorators/api.empty.response.decorator.js +28 -0
- package/dist/decorators/api.empty.response.decorator.js.map +1 -0
- package/dist/decorators/api.list.response.decorator.js +1 -1
- package/dist/decorators/api.list.response.decorator.js.map +1 -1
- package/dist/decorators/api.obj.response.decorator.js +1 -1
- package/dist/decorators/api.obj.response.decorator.js.map +1 -1
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.js +1 -0
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/response.dto.js +15 -6
- package/dist/decorators/response.dto.js.map +1 -1
- package/dist/exchanges/bitget/bitget.config.d.ts +10 -0
- package/dist/exchanges/bitget/bitget.config.js +7 -0
- package/dist/exchanges/bitget/bitget.config.js.map +1 -0
- package/dist/exchanges/bitget/bitget.module.d.ts +9 -0
- package/dist/exchanges/bitget/bitget.module.js +27 -0
- package/dist/exchanges/bitget/bitget.module.js.map +1 -0
- package/dist/exchanges/bitget/bitget.service.d.ts +72 -0
- package/dist/exchanges/bitget/bitget.service.js +63 -0
- package/dist/exchanges/bitget/bitget.service.js.map +1 -0
- package/dist/exchanges/bitget/index.d.ts +7 -0
- package/dist/exchanges/bitget/index.js +11 -0
- package/dist/exchanges/bitget/index.js.map +1 -0
- package/dist/exchanges/index.d.ts +1 -0
- package/dist/exchanges/index.js +1 -0
- package/dist/exchanges/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -95,6 +95,19 @@ export class MyLoggerModule {
|
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
## Bitget module
|
|
99
|
+
|
|
100
|
+
### config
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"bitget": {
|
|
105
|
+
"enabled": true,
|
|
106
|
+
"url": "https://api.bitget.com"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
98
111
|
## Bybit module
|
|
99
112
|
|
|
100
113
|
### config
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file api.empty.response.decorator.ts
|
|
4
|
+
* @date 2024
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ApiEmptyResponse = void 0;
|
|
8
|
+
const common_1 = require("@nestjs/common");
|
|
9
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
10
|
+
const response_dto_1 = require("./response.dto");
|
|
11
|
+
const ApiEmptyResponse = (description) => {
|
|
12
|
+
return (0, common_1.applyDecorators)((0, swagger_1.ApiOkResponse)({
|
|
13
|
+
schema: {
|
|
14
|
+
allOf: [
|
|
15
|
+
{ $ref: (0, swagger_1.getSchemaPath)(response_dto_1.ResponseDto) },
|
|
16
|
+
{
|
|
17
|
+
properties: {
|
|
18
|
+
code: { type: 'number', default: 0 },
|
|
19
|
+
message: { type: 'string', default: 'OK' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
description,
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
exports.ApiEmptyResponse = ApiEmptyResponse;
|
|
28
|
+
//# sourceMappingURL=api.empty.response.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.empty.response.decorator.js","sourceRoot":"","sources":["../../src/decorators/api.empty.response.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAiD;AACjD,6CAA+D;AAC/D,iDAA6C;AAEtC,MAAM,gBAAgB,GAAG,CAAC,WAAoB,EAAO,EAAE;IAC5D,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,0BAAW,CAAC,EAAE;gBACpC;oBACE,UAAU,EAAE;wBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE;wBACpC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;qBAC3C;iBACF;aACF;SACF;QACD,WAAW;KACZ,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,gBAAgB,oBAiB3B"}
|
|
@@ -26,7 +26,7 @@ const ApiListResponse = (model, description) => {
|
|
|
26
26
|
],
|
|
27
27
|
},
|
|
28
28
|
description,
|
|
29
|
-
}), (0, swagger_1.ApiExtraModels)(
|
|
29
|
+
}), (0, swagger_1.ApiExtraModels)(model));
|
|
30
30
|
};
|
|
31
31
|
exports.ApiListResponse = ApiListResponse;
|
|
32
32
|
//# sourceMappingURL=api.list.response.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.list.response.decorator.js","sourceRoot":"","sources":["../../src/decorators/api.list.response.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuD;AACvD,6CAA+E;AAC/E,iDAAiD;AAE1C,MAAM,eAAe,GAAG,CAA2B,KAAa,EAAE,WAAoB,EAAO,EAAE;IACpG,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,8BAAe,CAAC,EAAE;gBACxC;oBACE,UAAU,EAAE;wBACV,wCAAwC;wBACxC,8CAA8C;wBAC9C,IAAI,EAAE;4BACJ,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;yBACtC;qBACF;iBACF;aACF;SACF;QACD,WAAW;KACZ,CAAC,EACF,IAAA,wBAAc,EAAC,
|
|
1
|
+
{"version":3,"file":"api.list.response.decorator.js","sourceRoot":"","sources":["../../src/decorators/api.list.response.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuD;AACvD,6CAA+E;AAC/E,iDAAiD;AAE1C,MAAM,eAAe,GAAG,CAA2B,KAAa,EAAE,WAAoB,EAAO,EAAE;IACpG,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,8BAAe,CAAC,EAAE;gBACxC;oBACE,UAAU,EAAE;wBACV,wCAAwC;wBACxC,8CAA8C;wBAC9C,IAAI,EAAE;4BACJ,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;yBACtC;qBACF;iBACF;aACF;SACF;QACD,WAAW;KACZ,CAAC,EACF,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,eAAe,mBAsB1B"}
|
|
@@ -23,7 +23,7 @@ const ApiObjResponse = (model, description) => {
|
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
description,
|
|
26
|
-
}), (0, swagger_1.ApiExtraModels)(
|
|
26
|
+
}), (0, swagger_1.ApiExtraModels)(model));
|
|
27
27
|
};
|
|
28
28
|
exports.ApiObjResponse = ApiObjResponse;
|
|
29
29
|
//# sourceMappingURL=api.obj.response.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.obj.response.decorator.js","sourceRoot":"","sources":["../../src/decorators/api.obj.response.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuD;AACvD,6CAA+E;AAC/E,iDAAgD;AAEzC,MAAM,cAAc,GAAG,CAA2B,KAAa,EAAE,WAAoB,EAAO,EAAE;IACnG,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,6BAAc,CAAC,EAAE;gBACvC;oBACE,UAAU,EAAE;wBACV,wCAAwC;wBACxC,8CAA8C;wBAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;qBACrC;iBACF;aACF;SACF;QACD,WAAW;KACZ,CAAC,EACF,IAAA,wBAAc,EAAC,
|
|
1
|
+
{"version":3,"file":"api.obj.response.decorator.js","sourceRoot":"","sources":["../../src/decorators/api.obj.response.decorator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAuD;AACvD,6CAA+E;AAC/E,iDAAgD;AAEzC,MAAM,cAAc,GAAG,CAA2B,KAAa,EAAE,WAAoB,EAAO,EAAE;IACnG,OAAO,IAAA,wBAAe,EACpB,IAAA,uBAAa,EAAC;QACZ,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,6BAAc,CAAC,EAAE;gBACvC;oBACE,UAAU,EAAE;wBACV,wCAAwC;wBACxC,8CAA8C;wBAC9C,IAAI,EAAE,EAAE,IAAI,EAAE,IAAA,uBAAa,EAAC,KAAK,CAAC,EAAE;qBACrC;iBACF;aACF;SACF;QACD,WAAW;KACZ,CAAC,EACF,IAAA,wBAAc,EAAC,KAAK,CAAC,CACtB,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,cAAc,kBAmBzB"}
|
package/dist/decorators/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
tslib_1.__exportStar(require("./response.dto"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./api.empty.response.decorator"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./api.list.response.decorator"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./api.obj.response.decorator"), exports);
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAA+B;AAC/B,wEAA8C;AAC9C,uEAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAA+B;AAC/B,yEAA+C;AAC/C,wEAA8C;AAC9C,uEAA6C"}
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.ResponseListDto = exports.ResponseObjDto = exports.ResponseDto = void 0;
|
|
8
8
|
const tslib_1 = require("tslib");
|
|
9
9
|
const swagger_1 = require("@nestjs/swagger");
|
|
10
|
-
class ResponseDto {
|
|
11
|
-
}
|
|
10
|
+
let ResponseDto = class ResponseDto {
|
|
11
|
+
};
|
|
12
12
|
exports.ResponseDto = ResponseDto;
|
|
13
13
|
tslib_1.__decorate([
|
|
14
14
|
(0, swagger_1.ApiProperty)({ description: 'The result code, 0 means success, greater than 0 means failure.', example: 0 })
|
|
@@ -19,16 +19,25 @@ tslib_1.__decorate([
|
|
|
19
19
|
tslib_1.__decorate([
|
|
20
20
|
(0, swagger_1.ApiPropertyOptional)({ description: 'The failure reason.' })
|
|
21
21
|
], ResponseDto.prototype, "reason", void 0);
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
exports.ResponseDto = ResponseDto = tslib_1.__decorate([
|
|
23
|
+
(0, swagger_1.ApiExtraModels)()
|
|
24
|
+
], ResponseDto);
|
|
25
|
+
let ResponseObjDto = class ResponseObjDto extends ResponseDto {
|
|
26
|
+
};
|
|
24
27
|
exports.ResponseObjDto = ResponseObjDto;
|
|
25
28
|
tslib_1.__decorate([
|
|
26
29
|
(0, swagger_1.ApiProperty)()
|
|
27
30
|
], ResponseObjDto.prototype, "data", void 0);
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
exports.ResponseObjDto = ResponseObjDto = tslib_1.__decorate([
|
|
32
|
+
(0, swagger_1.ApiExtraModels)()
|
|
33
|
+
], ResponseObjDto);
|
|
34
|
+
let ResponseListDto = class ResponseListDto extends ResponseDto {
|
|
35
|
+
};
|
|
30
36
|
exports.ResponseListDto = ResponseListDto;
|
|
31
37
|
tslib_1.__decorate([
|
|
32
38
|
(0, swagger_1.ApiProperty)()
|
|
33
39
|
], ResponseListDto.prototype, "data", void 0);
|
|
40
|
+
exports.ResponseListDto = ResponseListDto = tslib_1.__decorate([
|
|
41
|
+
(0, swagger_1.ApiExtraModels)()
|
|
42
|
+
], ResponseListDto);
|
|
34
43
|
//# sourceMappingURL=response.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.dto.js","sourceRoot":"","sources":["../../src/decorators/response.dto.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"response.dto.js","sourceRoot":"","sources":["../../src/decorators/response.dto.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,6CAAmF;AAG5E,IAAM,WAAW,GAAjB,MAAM,WAAW;CASvB,CAAA;AATY,kCAAW;AAEtB;IADC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,iEAAiE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;yCAC/F;AAGb;IADC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAClD;AAGhB;IADC,IAAA,6BAAmB,EAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;2CAC5C;sBARL,WAAW;IADvB,IAAA,wBAAc,GAAE;GACJ,WAAW,CASvB;AAGM,IAAM,cAAc,GAApB,MAAM,cAAsB,SAAQ,WAAW;CAGrD,CAAA;AAHY,wCAAc;AAEzB;IADC,IAAA,qBAAW,GAAE;4CACF;yBAFD,cAAc;IAD1B,IAAA,wBAAc,GAAE;GACJ,cAAc,CAG1B;AAGM,IAAM,eAAe,GAArB,MAAM,eAAuB,SAAQ,WAAW;CAGtD,CAAA;AAHY,0CAAe;AAE1B;IADC,IAAA,qBAAW,GAAE;6CACA;0BAFH,eAAe;IAD3B,IAAA,wBAAc,GAAE;GACJ,eAAe,CAG3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitget.config.js","sourceRoot":"","sources":["../../../src/exchanges/bitget/bitget.config.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file bitget.module.ts
|
|
4
|
+
* @date 2024
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BitgetModule = void 0;
|
|
8
|
+
const config_1 = require("../../config");
|
|
9
|
+
const bitget_service_1 = require("./bitget.service");
|
|
10
|
+
class BitgetModule {
|
|
11
|
+
static forRoot(_options) {
|
|
12
|
+
return {
|
|
13
|
+
module: BitgetModule,
|
|
14
|
+
exports: [bitget_service_1.BitgetService],
|
|
15
|
+
providers: [
|
|
16
|
+
{
|
|
17
|
+
provide: 'BitgetConstant',
|
|
18
|
+
useFactory: (constant) => constant.config(),
|
|
19
|
+
inject: [config_1.ConfigService],
|
|
20
|
+
},
|
|
21
|
+
bitget_service_1.BitgetService,
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.BitgetModule = BitgetModule;
|
|
27
|
+
//# sourceMappingURL=bitget.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitget.module.js","sourceRoot":"","sources":["../../../src/exchanges/bitget/bitget.module.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yCAA4D;AAE5D,qDAAiD;AAEjD,MAAa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,QAAwB;QACrC,OAAO;YACL,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,CAAC,8BAAa,CAAC;YACxB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,gBAAgB;oBACzB,UAAU,EAAE,CAAC,QAAqC,EAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE;oBAC7E,MAAM,EAAE,CAAC,sBAAa,CAAC;iBACxB;gBACD,8BAAa;aACd;SACF,CAAC;IACJ,CAAC;CACF;AAfD,oCAeC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file bitget.service.ts
|
|
3
|
+
* @date 2024
|
|
4
|
+
* @see https://www.bitget.com/api-doc/
|
|
5
|
+
*/
|
|
6
|
+
import { BitgetConfig } from './bitget.config';
|
|
7
|
+
export declare class BitgetService {
|
|
8
|
+
private readonly constant;
|
|
9
|
+
private readonly instance;
|
|
10
|
+
constructor(constant: BitgetConfig);
|
|
11
|
+
checkConstant(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Get Ticker Information
|
|
14
|
+
* @param symbol e.g. BTCUSDT
|
|
15
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Tickers
|
|
16
|
+
*/
|
|
17
|
+
ticker(symbol?: string): Promise<{
|
|
18
|
+
code: string;
|
|
19
|
+
msg: string;
|
|
20
|
+
requestTime: number;
|
|
21
|
+
data: {
|
|
22
|
+
open: string;
|
|
23
|
+
symbol: string;
|
|
24
|
+
high24h: string;
|
|
25
|
+
low24h: string;
|
|
26
|
+
lastPr: string;
|
|
27
|
+
quoteVolume: string;
|
|
28
|
+
baseVolume: string;
|
|
29
|
+
usdtVolume: string;
|
|
30
|
+
ts: string;
|
|
31
|
+
bidPr: string;
|
|
32
|
+
askPr: string;
|
|
33
|
+
bidSz: string;
|
|
34
|
+
askSz: string;
|
|
35
|
+
openUtc: string;
|
|
36
|
+
changeUtc24h: string;
|
|
37
|
+
change24h: string;
|
|
38
|
+
}[];
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Get Candlestick Data
|
|
42
|
+
* @param symbol e.g. BTCUSDT
|
|
43
|
+
* @param granularity e.g. 1d
|
|
44
|
+
* @param startTime e.g. 1696089600000
|
|
45
|
+
* @param endTime e.g. 1698918180000
|
|
46
|
+
* @param limit e.g. 500
|
|
47
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Candle-Data
|
|
48
|
+
*/
|
|
49
|
+
klines(symbol: string, granularity: '1min' | '5min' | '15min' | '30min' | '1h' | '4h' | '6h' | '12h' | '1day' | '3day' | '1week' | '1M', startTime?: string | number, endTime?: string | number, limit?: string | number): Promise<{
|
|
50
|
+
code: string;
|
|
51
|
+
msg: string;
|
|
52
|
+
requestTime: number;
|
|
53
|
+
data: [string, string, string, string, string, string, string, string][];
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Get OrderBook Depth
|
|
57
|
+
* @param symbol e.g. BTCUSDT
|
|
58
|
+
* @param type e.g. step0
|
|
59
|
+
* @param limit e.g. 100
|
|
60
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Orderbook
|
|
61
|
+
*/
|
|
62
|
+
depth(symbol: string, type: 'step0' | 'step1' | 'step2' | 'step3' | 'step4' | 'step5', limit?: string | number): Promise<{
|
|
63
|
+
code: string;
|
|
64
|
+
msg: string;
|
|
65
|
+
requestTime: number;
|
|
66
|
+
data: {
|
|
67
|
+
asks: [string, string][];
|
|
68
|
+
bids: [string, string][];
|
|
69
|
+
ts: string;
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file bitget.service.ts
|
|
4
|
+
* @date 2024
|
|
5
|
+
* @see https://www.bitget.com/api-doc/
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BitgetService = void 0;
|
|
9
|
+
const tslib_1 = require("tslib");
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
12
|
+
let BitgetService = class BitgetService {
|
|
13
|
+
constructor(constant) {
|
|
14
|
+
this.constant = constant;
|
|
15
|
+
if (constant.bitget?.enabled) {
|
|
16
|
+
this.instance = axios_1.default.create({ baseURL: constant.bitget.url });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
checkConstant() {
|
|
20
|
+
if (!this.constant.bitget?.enabled) {
|
|
21
|
+
throw new common_1.HttpException('This feature is not supported', common_1.HttpStatus.BAD_REQUEST);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get Ticker Information
|
|
26
|
+
* @param symbol e.g. BTCUSDT
|
|
27
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Tickers
|
|
28
|
+
*/
|
|
29
|
+
async ticker(symbol) {
|
|
30
|
+
this.checkConstant();
|
|
31
|
+
return (await this.instance.get('/api/v2/spot/market/tickers', { params: { symbol } })).data;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get Candlestick Data
|
|
35
|
+
* @param symbol e.g. BTCUSDT
|
|
36
|
+
* @param granularity e.g. 1d
|
|
37
|
+
* @param startTime e.g. 1696089600000
|
|
38
|
+
* @param endTime e.g. 1698918180000
|
|
39
|
+
* @param limit e.g. 500
|
|
40
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Candle-Data
|
|
41
|
+
*/
|
|
42
|
+
async klines(symbol, granularity, startTime, endTime, limit) {
|
|
43
|
+
this.checkConstant();
|
|
44
|
+
return (await this.instance.get('/api/v2/spot/market/candles', { params: { symbol, granularity, startTime, endTime, limit } })).data;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get OrderBook Depth
|
|
48
|
+
* @param symbol e.g. BTCUSDT
|
|
49
|
+
* @param type e.g. step0
|
|
50
|
+
* @param limit e.g. 100
|
|
51
|
+
* @see https://www.bitget.com/api-doc/spot/market/Get-Orderbook
|
|
52
|
+
*/
|
|
53
|
+
async depth(symbol, type, limit) {
|
|
54
|
+
this.checkConstant();
|
|
55
|
+
return (await this.instance.get('/api/v2/spot/market/orderbook', { params: { symbol, type, limit } })).data;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
exports.BitgetService = BitgetService;
|
|
59
|
+
exports.BitgetService = BitgetService = tslib_1.__decorate([
|
|
60
|
+
(0, common_1.Injectable)(),
|
|
61
|
+
tslib_1.__param(0, (0, common_1.Inject)('BitgetConstant'))
|
|
62
|
+
], BitgetService);
|
|
63
|
+
//# sourceMappingURL=bitget.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitget.service.js","sourceRoot":"","sources":["../../../src/exchanges/bitget/bitget.service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,2CAA+E;AAC/E,0DAA6C;AAItC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB,YAAuD,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAC3E,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACnC,MAAM,IAAI,sBAAa,CAAC,+BAA+B,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;QACnF,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAAe;QAuB1B,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/F,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CACV,MAAc,EACd,WAAgH,EAChH,SAA2B,EAC3B,OAAyB,EACzB,KAAuB;QAOvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvI,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CACT,MAAc,EACd,IAA+D,EAC/D,KAAuB;QAWvB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,+BAA+B,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9G,CAAC;CACF,CAAA;AAhGY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAIE,mBAAA,IAAA,eAAM,EAAC,gBAAgB,CAAC,CAAA;GAH1B,aAAa,CAgGzB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file index.ts
|
|
4
|
+
* @date 2024
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./bitget.config"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./bitget.module"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./bitget.service"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exchanges/bitget/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0DAAgC;AAChC,0DAAgC;AAChC,2DAAiC"}
|
package/dist/exchanges/index.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
tslib_1.__exportStar(require("./binance"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./bingx"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./bitget"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./bybit"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./gate.io"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./lbank"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exchanges/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oDAA0B;AAC1B,kDAAwB;AACxB,kDAAwB;AACxB,oDAA0B;AAC1B,kDAAwB;AACxB,iDAAuB;AACvB,gDAAsB;AACtB,oDAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exchanges/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oDAA0B;AAC1B,kDAAwB;AACxB,mDAAyB;AACzB,kDAAwB;AACxB,oDAA0B;AAC1B,kDAAwB;AACxB,iDAAuB;AACvB,gDAAsB;AACtB,oDAA0B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volare.finance/nestjs.plugins",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "@volare.finance/nestjs.plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nest.js",
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@aws-sdk/client-s3": "^3.332.0",
|
|
21
21
|
"@nestjs/common": "^10.2.0",
|
|
22
|
-
"@nestjs/swagger": "^
|
|
22
|
+
"@nestjs/swagger": "^8.1.0",
|
|
23
23
|
"axios": "^1.7.0",
|
|
24
24
|
"dotenv": "^16.4.0",
|
|
25
25
|
"winston": "^3.12.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/express": "^
|
|
28
|
+
"@types/express": "^5.0.0",
|
|
29
29
|
"@types/node": "^20.3.1",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
31
|
-
"@typescript-eslint/parser": "^
|
|
32
|
-
"eslint": "^8.
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
31
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
32
|
+
"eslint": "^8.56.0",
|
|
33
33
|
"eslint-config-prettier": "^9.0.0",
|
|
34
34
|
"eslint-plugin-prettier": "^5.0.0",
|
|
35
|
-
"express": "^
|
|
35
|
+
"express": "^5.0.0",
|
|
36
36
|
"prettier": "^3.0.0",
|
|
37
37
|
"typescript": "^5.1.3"
|
|
38
38
|
},
|