@volare.finance/nestjs.plugins 1.1.6 → 1.1.7
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/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 +1 -1
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 @@
|
|
|
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 @@
|
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AMG;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"}
|