UNPKG

notbank

Version:
49 lines (48 loc) 2.27 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { Endpoint } from "../constants/endpoints.js"; import { RequestType } from "../core/serviceClient.js"; import { completeParams } from "../utils/completeParams.js"; export class AccountService { constructor(connection) { this.OMS_ID = 1; this.connection = connection; } /** * https://apidoc.notbank.exchange/#getaccounttransactions */ getAccountTransactions(request) { const paramsWithOMSId = completeParams(request, this.OMS_ID); return this.connection.apRequest(Endpoint.GET_ACCOUNT_TRANSACTIONS, RequestType.POST, paramsWithOMSId); } /** * https://apidoc.notbank.exchange/#getaccountpositions */ getAccountPositions(params) { const paramsWithOMSId = completeParams(params, this.OMS_ID); return this.connection.apRequest(Endpoint.GET_ACCOUNT_POSITIONS, RequestType.POST, paramsWithOMSId); } /** * https://apidoc.notbank.exchange/#getaccountinstrumentstatistics */ getAccountInstrumentStatistics(params) { const paramsWithOMSId = completeParams(params, this.OMS_ID); return this.connection.apRequest(Endpoint.GET_ACCOUNT_INSTRUMENT_STATISTICS, RequestType.POST, paramsWithOMSId); } /** * https://apidoc.notbank.exchange/#getaccountinfo */ getAccountInfo(params) { return __awaiter(this, void 0, void 0, function* () { const paramsWithOMSId = completeParams(params, this.OMS_ID); return this.connection.apRequest(Endpoint.GET_ACCOUNT_INFO, RequestType.POST, paramsWithOMSId); }); } }