nest-wrapper-kiwoom 0.6.0 → 0.7.0

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,12 @@
1
+ import { HttpService } from '@nestjs/axios';
2
+ import { Oauth2 } from '@services/oauth2.service';
3
+ import { KA01690Param, KA01690Response } from '@src/types';
4
+ export declare class AccountService {
5
+ private readonly httpService;
6
+ private readonly oauth2;
7
+ private readonly domain;
8
+ private readonly url;
9
+ private readonly headers;
10
+ constructor(httpService: HttpService, oauth2: Oauth2);
11
+ ka01690(ka01690Param: KA01690Param): Promise<KA01690Response>;
12
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
19
+ var __metadata = (this && this.__metadata) || function (k, v) {
20
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
21
+ };
22
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
23
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
24
+ return new (P || (P = Promise))(function (resolve, reject) {
25
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
26
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
27
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
28
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
29
+ });
30
+ };
31
+ var __generator = (this && this.__generator) || function (thisArg, body) {
32
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
33
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
34
+ function verb(n) { return function (v) { return step([n, v]); }; }
35
+ function step(op) {
36
+ if (f) throw new TypeError("Generator is already executing.");
37
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
38
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
39
+ if (y = 0, t) op = [op[0] & 2, t.value];
40
+ switch (op[0]) {
41
+ case 0: case 1: t = op; break;
42
+ case 4: _.label++; return { value: op[1], done: false };
43
+ case 5: _.label++; y = op[1]; op = [0]; continue;
44
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
45
+ default:
46
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
47
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
49
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
50
+ if (t[2]) _.ops.pop();
51
+ _.trys.pop(); continue;
52
+ }
53
+ op = body.call(thisArg, _);
54
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
55
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
56
+ }
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ exports.AccountService = void 0;
60
+ var common_1 = require("@nestjs/common");
61
+ var axios_1 = require("@nestjs/axios");
62
+ var oauth2_service_1 = require("@services/oauth2.service");
63
+ var AccountService = (function () {
64
+ function AccountService(httpService, oauth2) {
65
+ this.httpService = httpService;
66
+ this.oauth2 = oauth2;
67
+ this.domain = 'https://api.kiwoom.com';
68
+ this.url = '/api/dostk/acnt';
69
+ this.headers = { 'Content-Type': 'application/json;charset=UTF-8', 'cont-yn': 'N', 'next-key': 'N' };
70
+ }
71
+ AccountService.prototype.ka01690 = function (ka01690Param) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var _a, _b, params, response, e_1;
74
+ return __generator(this, function (_c) {
75
+ switch (_c.label) {
76
+ case 0:
77
+ _c.trys.push([0, 3, , 4]);
78
+ this.headers['api-id'] = 'ka01690';
79
+ _a = this.headers;
80
+ _b = 'authorization';
81
+ return [4, this.oauth2.getBearerToken()];
82
+ case 1:
83
+ _a[_b] = _c.sent();
84
+ params = __assign({}, ka01690Param);
85
+ return [4, this.httpService.axiosRef.post("".concat(this.domain).concat(this.url), params, { headers: this.headers })];
86
+ case 2:
87
+ response = _c.sent();
88
+ return [2, response.data];
89
+ case 3:
90
+ e_1 = _c.sent();
91
+ throw new common_1.InternalServerErrorException(e_1.message);
92
+ case 4: return [2];
93
+ }
94
+ });
95
+ });
96
+ };
97
+ AccountService = __decorate([
98
+ (0, common_1.Injectable)(),
99
+ __metadata("design:paramtypes", [axios_1.HttpService,
100
+ oauth2_service_1.Oauth2])
101
+ ], AccountService);
102
+ return AccountService;
103
+ }());
104
+ exports.AccountService = AccountService;
105
+ //# sourceMappingURL=account.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.service.js","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 export * from './account.service';
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./oauth2.service"), exports);
18
18
  __exportStar(require("./etf.service"), exports);
19
19
  __exportStar(require("./order.service"), exports);
20
+ __exportStar(require("./account.service"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,gDAA8B;AAC9B,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,gDAA8B;AAC9B,kDAAgC;AAChC,oDAAkC"}
@@ -9,3 +9,4 @@ export * from './ka40007';
9
9
  export * from './ka40008';
10
10
  export * from './ka40009';
11
11
  export * from './ka40010';
12
+ export * from './ka01690';
@@ -25,4 +25,5 @@ __exportStar(require("./ka40007"), exports);
25
25
  __exportStar(require("./ka40008"), exports);
26
26
  __exportStar(require("./ka40009"), exports);
27
27
  __exportStar(require("./ka40010"), exports);
28
+ __exportStar(require("./ka01690"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B"}
@@ -0,0 +1,29 @@
1
+ export interface KA01690Param {
2
+ qry_dt: string;
3
+ }
4
+ interface DayBalRt {
5
+ cur_prc: string;
6
+ stk_cd: string;
7
+ stk_nm: string;
8
+ rmnd_qty: string;
9
+ buy_uv: string;
10
+ buy_wght: string;
11
+ evltv_prft: string;
12
+ prft_rt: string;
13
+ evlt_amt: string;
14
+ evlt_wght: string;
15
+ }
16
+ export interface KA01690Response {
17
+ dt: string;
18
+ tot_buy_amt: string;
19
+ tot_evlt_amt: string;
20
+ tot_evltv_prft: string;
21
+ tot_prft_rt: string;
22
+ dbst_bal: string;
23
+ day_stk_asst: string;
24
+ buy_wght: string;
25
+ day_bal_rt: DayBalRt[];
26
+ return_code: number;
27
+ return_msg: string;
28
+ }
29
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ka01690.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ka01690.js","sourceRoot":"","sources":["../../src/types/ka01690.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nest-wrapper-kiwoom",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "homepage": "https://github.com/gong-yeongbin/nest-wrapper-kiwoom",
5
5
  "description": "A Nest module wrapper for 키움 REST API",
6
6
  "main": "dist/index.js",