notbank
Version:
The Notbank for Node.js
1,297 lines (1,238 loc) • 115 kB
JavaScript
var NotbankSdk = (() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// node_modules/node-fetch/browser.js
var require_browser = __commonJS({
"node_modules/node-fetch/browser.js"(exports, module) {
"use strict";
var getGlobal = function() {
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw new Error("unable to locate global object");
};
var globalObject = getGlobal();
module.exports = exports = globalObject.fetch;
if (globalObject.fetch) {
exports.default = globalObject.fetch.bind(globalObject);
}
exports.Headers = globalObject.Headers;
exports.Request = globalObject.Request;
exports.Response = globalObject.Response;
}
});
// node_modules/universal-websocket-client/browser.js
var require_browser2 = __commonJS({
"node_modules/universal-websocket-client/browser.js"(exports, module) {
"use strict";
module.exports = WebSocket;
}
});
// lib/index.ts
var index_exports = {};
__export(index_exports, {
NotbankClient: () => NotbankClient,
models: () => models_exports
});
// lib/models/index.ts
var models_exports = {};
__export(models_exports, {
AccountType: () => AccountType,
ActionType: () => ActionType,
ArgentinaBankAccountKind: () => ArgentinaBankAccountKind,
BrazilBankAccountKind: () => BrazilBankAccountKind,
ChangeReason: () => ChangeReason,
ChileBankAccountKind: () => ChileBankAccountKind,
ColombiaBankAccountKind: () => ColombiaBankAccountKind,
DepositFeeMessages: () => DepositFeeMessages,
DepositStatus: () => DepositStatus,
Direction: () => Direction,
FeeCalcType: () => FeeCalcType,
FeeProductType: () => FeeProductType,
FeeType: () => FeeType,
InstrumentStateArgument: () => InstrumentStateArgument,
InstrumentType: () => InstrumentType,
MakerTaker: () => MakerTaker,
NotbankError: () => NotbankError,
OrderFlag: () => OrderFlag,
OrderSide: () => OrderSide,
OrderState: () => OrderState,
OrderTypeInt: () => OrderTypeInt,
OrderTypeStr: () => OrderTypeStr,
PegPriceType: () => PegPriceType,
PeruBankAccountKind: () => PeruBankAccountKind,
PixType: () => PixType,
ProductType: () => ProductType,
ReferenceType: () => ReferenceType,
ReportFlavor: () => ReportFlavor,
ReportFrequency: () => ReportFrequency,
ReportRequestStatus: () => ReportRequestStatus,
ReportWriterResultStatus: () => ReportWriterResultStatus,
RiskType: () => RiskType,
SessionStatus: () => SessionStatus,
SideType: () => SideType,
SubscriptionResponse: () => SubscriptionResponse,
SupportedCountry: () => SupportedCountry,
TimeInForce: () => TimeInForce,
TradeDirection: () => TradeDirection,
TradeSide: () => TradeSide,
TransactionReferenceTypes: () => TransactionReferenceTypes,
TransactionTypes: () => TransactionTypes,
UnsubscribeLevel2ErrorCode: () => UnsubscribeLevel2ErrorCode,
UnsubscribeTradesError: () => UnsubscribeTradesError,
UnsubscriptionResponse: () => UnsubscriptionResponse,
WithdrawErrorCode: () => WithdrawErrorCode,
WithdrawFeeMessages: () => WithdrawFeeMessages,
WithdrawTemplateType: () => WithdrawTemplateType,
orderbookFromRaw: () => orderbookFromRaw
});
// lib/models/enums/accountType.ts
var AccountType = /* @__PURE__ */ ((AccountType2) => {
AccountType2["ASSET"] = "Asset";
AccountType2["LIABILITY"] = "Liability";
return AccountType2;
})(AccountType || {});
// lib/models/enums/actionType.ts
var ActionType = /* @__PURE__ */ ((ActionType2) => {
ActionType2[ActionType2["NEW"] = 0] = "NEW";
ActionType2[ActionType2["UPDATE"] = 1] = "UPDATE";
ActionType2[ActionType2["DELETION"] = 2] = "DELETION";
return ActionType2;
})(ActionType || {});
// lib/models/enums/bankAccounts.ts
var ArgentinaBankAccountKind = /* @__PURE__ */ ((ArgentinaBankAccountKind2) => {
ArgentinaBankAccountKind2["CORRIENTE"] = "corriente";
ArgentinaBankAccountKind2["VISTA"] = "vista";
ArgentinaBankAccountKind2["AHORRO"] = "ahorro";
ArgentinaBankAccountKind2["ELECTRONIC_CHECKBOOK"] = "electronic_checkbook";
ArgentinaBankAccountKind2["AR_CBU"] = "ar_cbu";
ArgentinaBankAccountKind2["AR_CVU"] = "ar_cvu";
ArgentinaBankAccountKind2["AR_ALIAS"] = "ar_alias";
return ArgentinaBankAccountKind2;
})(ArgentinaBankAccountKind || {});
var BrazilBankAccountKind = /* @__PURE__ */ ((BrazilBankAccountKind2) => {
BrazilBankAccountKind2["BR_CORRIENTE_FISICA"] = "br_corriente_fisica";
BrazilBankAccountKind2["BR_SIMPLE_FISICA"] = "br_simple_fisica";
BrazilBankAccountKind2["BR_CORRIENTE_JURIDICA"] = "br_corriente_juridica";
BrazilBankAccountKind2["BR_POUPANCA_FISICA"] = "br_poupanca_fisica";
BrazilBankAccountKind2["BR_POUPANCA_JURIDICA"] = "br_poupanca_juridica";
BrazilBankAccountKind2["BR_CAIXA_FACIL"] = "br_caixa_facil";
BrazilBankAccountKind2["BR_PIX"] = "br_pix";
return BrazilBankAccountKind2;
})(BrazilBankAccountKind || {});
var ChileBankAccountKind = /* @__PURE__ */ ((ChileBankAccountKind2) => {
ChileBankAccountKind2["CORRIENTE"] = "corriente";
ChileBankAccountKind2["VISTA"] = "vista";
ChileBankAccountKind2["AHORRO"] = "ahorro";
ChileBankAccountKind2["ELECTRONIC_CHECKBOOK"] = "electronic_checkbook";
return ChileBankAccountKind2;
})(ChileBankAccountKind || {});
var PeruBankAccountKind = /* @__PURE__ */ ((PeruBankAccountKind2) => {
PeruBankAccountKind2["CORRIENTE"] = "corriente";
PeruBankAccountKind2["AHORRO"] = "ahorro";
return PeruBankAccountKind2;
})(PeruBankAccountKind || {});
var ColombiaBankAccountKind = /* @__PURE__ */ ((ColombiaBankAccountKind2) => {
ColombiaBankAccountKind2["CORRIENTE"] = "corriente";
ColombiaBankAccountKind2["AHORRO"] = "ahorro";
return ColombiaBankAccountKind2;
})(ColombiaBankAccountKind || {});
// lib/models/enums/changeReason.ts
var ChangeReason = /* @__PURE__ */ ((ChangeReason2) => {
ChangeReason2["UNKNOWN"] = "Unknown";
ChangeReason2["NEWINPUTACCEPTED"] = "NewInputAccepted";
ChangeReason2["NEWINPUTREJECTED"] = "NewInputRejected";
ChangeReason2["OTHERREJECTED"] = "OtherRejected";
ChangeReason2["EXPIRED"] = "Expired";
ChangeReason2["TRADE"] = "Trade";
ChangeReason2["SYSTEMCANCELED_NOMOREDMARKET"] = "SystemCanceled_NoMoreMarket";
ChangeReason2["SYSTEMCANCELED_BELOWMINIMUM"] = "SystemCanceled_BelowMinimum";
ChangeReason2["SYSTEMCANCELED_PRICECOLLAR"] = "SystemCanceled_PriceCollar";
ChangeReason2["SYSTEMCANCELED_MARGINFAILED"] = "SystemCanceled_MarginFailed";
ChangeReason2["USERMODIFIED"] = "UserModified";
return ChangeReason2;
})(ChangeReason || {});
// lib/models/enums/countries.ts
var SupportedCountry = /* @__PURE__ */ ((SupportedCountry2) => {
SupportedCountry2["AR"] = "AR";
SupportedCountry2["BR"] = "BR";
SupportedCountry2["CL"] = "CL";
SupportedCountry2["PE"] = "PE";
SupportedCountry2["CO"] = "CO";
return SupportedCountry2;
})(SupportedCountry || {});
// lib/models/enums/depositFeeMessages.ts
var DepositFeeMessages = /* @__PURE__ */ ((DepositFeeMessages2) => {
DepositFeeMessages2["Success"] = "Fee calculated successfully";
DepositFeeMessages2["InvalidRequest"] = "Invalid Request";
DepositFeeMessages2["AccountOrProductNotFound"] = "Account or Product not found";
return DepositFeeMessages2;
})(DepositFeeMessages || {});
// lib/models/enums/depositStatus.ts
var DepositStatus = /* @__PURE__ */ ((DepositStatus2) => {
DepositStatus2["New"] = "New";
DepositStatus2["Pending"] = "Pending";
DepositStatus2["FullyProcessed"] = "FullyProcessed";
DepositStatus2["Error"] = "Error";
return DepositStatus2;
})(DepositStatus || {});
// lib/models/enums/direction.ts
var Direction = /* @__PURE__ */ ((Direction2) => {
Direction2[Direction2["NoChange"] = 0] = "NoChange";
Direction2[Direction2["Uptick"] = 1] = "Uptick";
Direction2[Direction2["DownTick"] = 2] = "DownTick";
return Direction2;
})(Direction || {});
// lib/models/enums/feeProductType.ts
var FeeProductType = /* @__PURE__ */ ((FeeProductType2) => {
FeeProductType2["BASE_PRODUCT"] = "BaseProduct";
FeeProductType2["SINGLE_PRODUCT"] = "SingleProduct";
return FeeProductType2;
})(FeeProductType || {});
// lib/models/enums/instrumentStateArgument.ts
var InstrumentStateArgument = /* @__PURE__ */ ((InstrumentStateArgument2) => {
InstrumentStateArgument2["BOTH"] = "BOTH";
InstrumentStateArgument2["INACTIVE"] = "INACTIVE";
return InstrumentStateArgument2;
})(InstrumentStateArgument || {});
// lib/models/enums/instrumentType.ts
var InstrumentType = /* @__PURE__ */ ((InstrumentType2) => {
InstrumentType2["UNKNOWN"] = "Unknown";
InstrumentType2["STANDARD"] = "Standard";
return InstrumentType2;
})(InstrumentType || {});
// lib/models/enums/makerTaker.ts
var MakerTaker = /* @__PURE__ */ ((MakerTaker2) => {
MakerTaker2[MakerTaker2["Unknown"] = 0] = "Unknown";
MakerTaker2[MakerTaker2["Maker"] = 1] = "Maker";
MakerTaker2[MakerTaker2["Taker"] = 2] = "Taker";
return MakerTaker2;
})(MakerTaker || {});
// lib/models/enums/orderFlag.ts
var OrderFlag = /* @__PURE__ */ ((OrderFlag2) => {
OrderFlag2["NoAccountRiskCheck"] = "NoAccountRiskCheck";
OrderFlag2["AddedToBook"] = "AddedToBook";
OrderFlag2["RemovedFromBook"] = "RemovedFromBook";
OrderFlag2["PostOnly"] = "PostOnly";
OrderFlag2["Liquidation"] = "Liquidation";
OrderFlag2["ReverseMarginPosition"] = "ReverseMarginPosition";
return OrderFlag2;
})(OrderFlag || {});
// lib/models/enums/orderSide.ts
var OrderSide = /* @__PURE__ */ ((OrderSide2) => {
OrderSide2[OrderSide2["Buy"] = 0] = "Buy";
OrderSide2[OrderSide2["Sell"] = 1] = "Sell";
return OrderSide2;
})(OrderSide || {});
// lib/models/enums/orderState.ts
var OrderState = /* @__PURE__ */ ((OrderState2) => {
OrderState2["Unknown"] = "Unknown";
OrderState2["Working"] = "Working";
OrderState2["Rejected"] = "Rejected";
OrderState2["Canceled"] = "Canceled";
OrderState2["Expired"] = "Expired";
OrderState2["FullyExecuted"] = "Fully Executed";
return OrderState2;
})(OrderState || {});
// lib/models/enums/orderType.ts
var OrderTypeInt = /* @__PURE__ */ ((OrderTypeInt2) => {
OrderTypeInt2[OrderTypeInt2["Unknown"] = 0] = "Unknown";
OrderTypeInt2[OrderTypeInt2["Market"] = 1] = "Market";
OrderTypeInt2[OrderTypeInt2["Limit"] = 2] = "Limit";
OrderTypeInt2[OrderTypeInt2["StopMarket"] = 3] = "StopMarket";
OrderTypeInt2[OrderTypeInt2["StopLimit"] = 4] = "StopLimit";
OrderTypeInt2[OrderTypeInt2["TrailingStopMarket"] = 5] = "TrailingStopMarket";
OrderTypeInt2[OrderTypeInt2["TrailingStopLimit"] = 6] = "TrailingStopLimit";
OrderTypeInt2[OrderTypeInt2["BlockTrade"] = 7] = "BlockTrade";
return OrderTypeInt2;
})(OrderTypeInt || {});
var OrderTypeStr = /* @__PURE__ */ ((OrderTypeStr2) => {
OrderTypeStr2["Unknown"] = "Unknown";
OrderTypeStr2["Market"] = "Market";
OrderTypeStr2["Limit"] = "Limit";
OrderTypeStr2["StopMarket"] = "StopMarket";
OrderTypeStr2["StopLimit"] = "StopLimit";
OrderTypeStr2["TrailingStopMarket"] = "TrailingStopMarket";
OrderTypeStr2["TrailingStopLimit"] = "TrailingStopLimit";
OrderTypeStr2["BlockTrade"] = "BlockTrade";
return OrderTypeStr2;
})(OrderTypeStr || {});
// lib/models/enums/pegPriceType.ts
var PegPriceType = /* @__PURE__ */ ((PegPriceType2) => {
PegPriceType2[PegPriceType2["Last"] = 1] = "Last";
PegPriceType2[PegPriceType2["Bid"] = 2] = "Bid";
PegPriceType2[PegPriceType2["Ask"] = 3] = "Ask";
PegPriceType2[PegPriceType2["Midpoint"] = 4] = "Midpoint";
return PegPriceType2;
})(PegPriceType || {});
// lib/models/enums/pixType.ts
var PixType = /* @__PURE__ */ ((PixType2) => {
PixType2["CPF"] = "CPF";
PixType2["CNPJ"] = "CNPJ";
PixType2["EMAIL"] = "Email";
PixType2["PHONE"] = "Phone";
PixType2["OTRO"] = "Otro";
return PixType2;
})(PixType || {});
// lib/models/enums/productType.ts
var ProductType = /* @__PURE__ */ ((ProductType2) => {
ProductType2["UNKNOWN"] = "Unknown";
ProductType2["NATIONAL_CURRENCY"] = "NationalCurrency";
ProductType2["CRYPTO_CURRENCY"] = "CryptoCurrency";
ProductType2["CONTRACT"] = "Contract";
return ProductType2;
})(ProductType || {});
// lib/models/enums/referenceType.ts
var ReferenceType = /* @__PURE__ */ ((ReferenceType2) => {
ReferenceType2["Withdraw"] = "Withdraw";
return ReferenceType2;
})(ReferenceType || {});
// lib/models/enums/reportFlavor.ts
var ReportFlavor = /* @__PURE__ */ ((ReportFlavor2) => {
ReportFlavor2["TradeActivity"] = "TradeActivity";
ReportFlavor2["TransactionActivity"] = "TransactionActivity";
ReportFlavor2["ProductDelta"] = "ProductDelta";
ReportFlavor2["ProfitAndLoss"] = "ProfitAndLoss";
ReportFlavor2["Transaction"] = "Transaction";
ReportFlavor2["Treasury"] = "Treasury";
return ReportFlavor2;
})(ReportFlavor || {});
// lib/models/enums/reportFrequency.ts
var ReportFrequency = /* @__PURE__ */ ((ReportFrequency2) => {
ReportFrequency2["OnDemand"] = "OnDemand";
ReportFrequency2["Hourly"] = "Hourly";
ReportFrequency2["Daily"] = "Daily";
ReportFrequency2["Weekly"] = "Weekly";
ReportFrequency2["Monthly"] = "Monthly";
ReportFrequency2["Annually"] = "Annually";
return ReportFrequency2;
})(ReportFrequency || {});
// lib/models/enums/reportRequestStatus.ts
var ReportRequestStatus = /* @__PURE__ */ ((ReportRequestStatus2) => {
ReportRequestStatus2["Submitted"] = "Submitted";
ReportRequestStatus2["Validating"] = "Validating";
ReportRequestStatus2["Scheduled"] = "Scheduled";
ReportRequestStatus2["InProgress"] = "InProgress";
ReportRequestStatus2["Completed"] = "Completed";
ReportRequestStatus2["Aborting"] = "Aborting";
ReportRequestStatus2["Aborted"] = "Aborted";
ReportRequestStatus2["UserCancelled"] = "UserCancelled";
ReportRequestStatus2["SysRetired"] = "SysRetired";
ReportRequestStatus2["Pending"] = "Pending";
ReportRequestStatus2["UserCancelPending"] = "UserCancelPending";
return ReportRequestStatus2;
})(ReportRequestStatus || {});
// lib/models/enums/reportWriterResultStatus.ts
var ReportWriterResultStatus = /* @__PURE__ */ ((ReportWriterResultStatus2) => {
ReportWriterResultStatus2["NotStarted"] = "NotStarted";
ReportWriterResultStatus2["NotComplete"] = "NotComplete";
ReportWriterResultStatus2["ErrorComplete"] = "ErrorComplete";
ReportWriterResultStatus2["SuccessComplete"] = "SuccessComplete";
ReportWriterResultStatus2["Cancelled"] = "Cancelled";
return ReportWriterResultStatus2;
})(ReportWriterResultStatus || {});
// lib/models/enums/riskType.ts
var RiskType = /* @__PURE__ */ ((RiskType2) => {
RiskType2["UNKNOWN"] = "Unknown";
RiskType2["NORMAL"] = "Normal";
RiskType2["NO_RISK_CHECK"] = "NoRiskCheck";
RiskType2["NO_TRADING"] = "NoTrading";
RiskType2["CREDIT"] = "Credit";
return RiskType2;
})(RiskType || {});
// lib/models/enums/sessionStatus.ts
var SessionStatus = /* @__PURE__ */ ((SessionStatus2) => {
SessionStatus2["UNKNOWN"] = "Unknown";
SessionStatus2["RUNNING"] = "Running";
SessionStatus2["PAUSED"] = "Paused";
SessionStatus2["STOPPED"] = "Stopped";
SessionStatus2["STARTING"] = "Starting";
SessionStatus2["RUNNING_POST_ONLY"] = "RunningPostOnly";
return SessionStatus2;
})(SessionStatus || {});
// lib/models/enums/sideType.ts
var SideType = /* @__PURE__ */ ((SideType2) => {
SideType2["BUY"] = "Buy";
SideType2["SELL"] = "Sell";
return SideType2;
})(SideType || {});
// lib/models/enums/timeInForce.ts
var TimeInForce = /* @__PURE__ */ ((TimeInForce2) => {
TimeInForce2[TimeInForce2["Unknown"] = 0] = "Unknown";
TimeInForce2[TimeInForce2["GTC"] = 1] = "GTC";
TimeInForce2[TimeInForce2["OPG"] = 2] = "OPG";
TimeInForce2[TimeInForce2["IOC"] = 3] = "IOC";
TimeInForce2[TimeInForce2["FOK"] = 4] = "FOK";
TimeInForce2[TimeInForce2["GTX"] = 5] = "GTX";
TimeInForce2[TimeInForce2["GTD"] = 6] = "GTD";
return TimeInForce2;
})(TimeInForce || {});
// lib/models/enums/tradeDirection.ts
var TradeDirection = /* @__PURE__ */ ((TradeDirection2) => {
TradeDirection2[TradeDirection2["NoChange"] = 0] = "NoChange";
TradeDirection2[TradeDirection2["Uptick"] = 1] = "Uptick";
TradeDirection2[TradeDirection2["DownTick"] = 2] = "DownTick";
return TradeDirection2;
})(TradeDirection || {});
// lib/models/enums/tradeSide.ts
var TradeSide = /* @__PURE__ */ ((TradeSide2) => {
TradeSide2[TradeSide2["Buy"] = 0] = "Buy";
TradeSide2[TradeSide2["Sell"] = 1] = "Sell";
TradeSide2[TradeSide2["Short"] = 2] = "Short";
TradeSide2[TradeSide2["Unknown"] = 3] = "Unknown";
return TradeSide2;
})(TradeSide || {});
// lib/models/enums/transactionReferenceTypes.ts
var TransactionReferenceTypes = /* @__PURE__ */ ((TransactionReferenceTypes2) => {
TransactionReferenceTypes2["Trade"] = "Trade";
TransactionReferenceTypes2["Deposit"] = "Deposit";
TransactionReferenceTypes2["Withdraw"] = "Withdraw";
TransactionReferenceTypes2["Transfer"] = "Transfer";
TransactionReferenceTypes2["OrderHold"] = "OrderHold";
TransactionReferenceTypes2["WithdrawHold"] = "WithdrawHold";
TransactionReferenceTypes2["DepositHold"] = "DepositHold";
TransactionReferenceTypes2["MarginHold"] = "MarginHold";
TransactionReferenceTypes2["ManualHold"] = "ManualHold";
TransactionReferenceTypes2["ManualEntry"] = "ManualEntry";
TransactionReferenceTypes2["MarginAcquisition"] = "MarginAcquisition";
TransactionReferenceTypes2["MarginRelinquish"] = "MarginRelinquish";
TransactionReferenceTypes2["MarginInterestNetting"] = "MarginInterestNetting";
TransactionReferenceTypes2["MarginOperatorTransferToMarginAccount"] = "MarginOperatorTransferToMarginAccount";
TransactionReferenceTypes2["MarginOperatorTransferToAssetAccount"] = "MarginOperatorTransferToAssetAccount";
TransactionReferenceTypes2["MarginUserTransfer"] = "MarginUserTransfer";
TransactionReferenceTypes2["MarginPositionReverseTrade"] = "MarginPositionReverseTrade";
TransactionReferenceTypes2["AffiliateRebate"] = "AffiliateRebate";
TransactionReferenceTypes2["DistributionEntry"] = "DistributionEntry";
TransactionReferenceTypes2["TransferHold"] = "TransferHold";
TransactionReferenceTypes2["AirDrop"] = "AirDrop";
return TransactionReferenceTypes2;
})(TransactionReferenceTypes || {});
// lib/models/enums/transactionTypes.ts
var TransactionTypes = /* @__PURE__ */ ((TransactionTypes2) => {
TransactionTypes2["Fee"] = "Fee";
TransactionTypes2["Trade"] = "Trade";
TransactionTypes2["Other"] = "Other";
TransactionTypes2["Reverse"] = "Reverse";
TransactionTypes2["Hold"] = "Hold";
TransactionTypes2["Rebate"] = "Rebate";
TransactionTypes2["MarginAcquisition"] = "MarginAcquisition";
TransactionTypes2["MarginRelinquishByTrade"] = "MarginRelinquishByTrade";
TransactionTypes2["MarginInterestTransfer"] = "MarginInterestTransfer";
TransactionTypes2["MarginOperatorTransferToMarginAccount"] = "MarginOperatorTransferToMarginAccount";
TransactionTypes2["MarginOperatorTransferToAssetAccount"] = "MarginOperatorTransferToAssetAccount";
TransactionTypes2["MarginUserTransfer"] = "MarginUserTransfer";
TransactionTypes2["MarginRelinquishByTransfer"] = "MarginRelinquishByTransfer";
TransactionTypes2["MarginRelinquishByReverseTrade"] = "MarginRelinquishByReverseTrade";
TransactionTypes2["Distribution"] = "Distribution";
TransactionTypes2["Payment"] = "Payment";
TransactionTypes2["OperatorLend"] = "OperatorLend";
TransactionTypes2["OperatorReceived"] = "OperatorReceived";
TransactionTypes2["Rebalance"] = "Rebalance";
TransactionTypes2["Commission"] = "Commission";
TransactionTypes2["AirDrop"] = "AirDrop";
return TransactionTypes2;
})(TransactionTypes || {});
// lib/models/enums/unsubscribeLevel2ErrorCode.ts
var UnsubscribeLevel2ErrorCode = /* @__PURE__ */ ((UnsubscribeLevel2ErrorCode2) => {
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["SUCCESS"] = 0] = "SUCCESS";
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["NOT_AUTHORIZED"] = 20] = "NOT_AUTHORIZED";
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["INVALID_REQUEST"] = 100] = "INVALID_REQUEST";
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["OPERATION_FAILED"] = 101] = "OPERATION_FAILED";
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["SERVER_ERROR"] = 102] = "SERVER_ERROR";
UnsubscribeLevel2ErrorCode2[UnsubscribeLevel2ErrorCode2["RESOURCE_NOT_FOUND"] = 104] = "RESOURCE_NOT_FOUND";
return UnsubscribeLevel2ErrorCode2;
})(UnsubscribeLevel2ErrorCode || {});
// lib/models/enums/unsubscribeTradesError.ts
var UnsubscribeTradesError = /* @__PURE__ */ ((UnsubscribeTradesError2) => {
UnsubscribeTradesError2[UnsubscribeTradesError2["NotAuthorized"] = 20] = "NotAuthorized";
UnsubscribeTradesError2[UnsubscribeTradesError2["InvalidRequest"] = 100] = "InvalidRequest";
UnsubscribeTradesError2[UnsubscribeTradesError2["OperationFailed"] = 101] = "OperationFailed";
UnsubscribeTradesError2[UnsubscribeTradesError2["ServerError"] = 102] = "ServerError";
UnsubscribeTradesError2[UnsubscribeTradesError2["ResourceNotFound"] = 104] = "ResourceNotFound";
return UnsubscribeTradesError2;
})(UnsubscribeTradesError || {});
// lib/models/enums/withdrawErrorCode.ts
var WithdrawErrorCode = /* @__PURE__ */ ((WithdrawErrorCode2) => {
WithdrawErrorCode2[WithdrawErrorCode2["NoError"] = 0] = "NoError";
WithdrawErrorCode2[WithdrawErrorCode2["NotAuthorized"] = 20] = "NotAuthorized";
WithdrawErrorCode2[WithdrawErrorCode2["InvalidRequest"] = 100] = "InvalidRequest";
WithdrawErrorCode2[WithdrawErrorCode2["OperationFailed"] = 101] = "OperationFailed";
WithdrawErrorCode2[WithdrawErrorCode2["ServerError"] = 102] = "ServerError";
WithdrawErrorCode2[WithdrawErrorCode2["ResourceNotFound"] = 104] = "ResourceNotFound";
return WithdrawErrorCode2;
})(WithdrawErrorCode || {});
// lib/models/enums/withdrawFeeMessages.ts
var WithdrawFeeMessages = /* @__PURE__ */ ((WithdrawFeeMessages2) => {
WithdrawFeeMessages2["Success"] = "Fee calculated successfully";
WithdrawFeeMessages2["InvalidRequest"] = "Invalid Request";
WithdrawFeeMessages2["AccountOrProductNotFound"] = "Account or Product not found";
return WithdrawFeeMessages2;
})(WithdrawFeeMessages || {});
// lib/models/enums/withdrawTemplateType.ts
var WithdrawTemplateType = /* @__PURE__ */ ((WithdrawTemplateType2) => {
WithdrawTemplateType2["ToExternalBitcoinAddress"] = "ToExternalBitcoinAddress";
WithdrawTemplateType2["ToInternalAccount"] = "ToInternalAccount";
WithdrawTemplateType2["ToBankAccount"] = "ToBankAccount";
return WithdrawTemplateType2;
})(WithdrawTemplateType || {});
// lib/models/response/getAccountFees.ts
var FeeCalcType = /* @__PURE__ */ ((FeeCalcType2) => {
FeeCalcType2["Flat"] = "Flat";
FeeCalcType2["Percentage"] = "Percentage";
return FeeCalcType2;
})(FeeCalcType || {});
var FeeType = /* @__PURE__ */ ((FeeType2) => {
FeeType2["Flat"] = "Flat";
FeeType2["MakerFee"] = "MakerFee";
FeeType2["TakerFee"] = "TakerFee";
FeeType2["PeggedProductFee"] = "PeggedProductFee";
FeeType2["AffiliateFee"] = "AffiliateFee";
return FeeType2;
})(FeeType || {});
// lib/models/response/orderBook.ts
function orderbookFromRaw(raw) {
return {
timestamp: raw.timestamp,
bids: raw.bids.map((level) => {
return { quantity: level[0], price: level[1] };
}),
asks: raw.asks.map((level) => {
return { quantity: level[0], price: level[1] };
})
};
}
// lib/models/notbankError.ts
var _NotbankError = class _NotbankError extends Error {
constructor(message, code) {
super("Notbank Error. " + message);
this.code = code;
}
};
_NotbankError.Factory = class Factory {
static createFromApResponse(standardResponse) {
var errMsg = "";
if (standardResponse.errorcode) {
errMsg += `(code=${standardResponse.errorcode})`;
}
if (standardResponse.errormsg) {
errMsg += " " + standardResponse.errormsg + ".";
}
if (standardResponse.detail) {
errMsg += " " + standardResponse.detail + ".";
}
return new _NotbankError(
errMsg,
standardResponse.errorcode || standardResponse.statusCode
);
}
static createFromNbResponse(standardResponse) {
var errMsg = "";
if (standardResponse.message) {
errMsg += standardResponse.message;
if (!standardResponse.message.endsWith(".")) {
errMsg += ".";
}
}
if (standardResponse.detail) {
errMsg += " " + standardResponse.detail;
if (!standardResponse.detail.endsWith(".")) {
errMsg += ".";
}
}
return new _NotbankError(
errMsg,
-1
);
}
};
var NotbankError = _NotbankError;
// lib/models/subscriptionResponse.ts
var UnsubscriptionResponse = class {
};
// lib/models/unsubscriptionResponse.ts
var SubscriptionResponse = class {
};
// lib/core/hmac.ts
var import_crypto = __toESM(__require("crypto"), 1);
function getRandomInt(max) {
return Math.floor(Math.random() * max);
}
function getNonce() {
return getRandomInt(1e6).toString();
}
function sign(apiPublicKey, apiSecretKey, userId, nonce) {
var message = nonce + userId + apiPublicKey;
const hmac256 = import_crypto.default.createHmac("sha256", apiSecretKey);
hmac256.update(message);
return hmac256.digest("hex");
}
// lib/constants/errorCode.ts
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
ErrorCode2[ErrorCode2["UNDEFINED"] = -1] = "UNDEFINED";
ErrorCode2[ErrorCode2["NOT_AN_ERROR"] = 0] = "NOT_AN_ERROR";
ErrorCode2[ErrorCode2["NOT_AUTHORIZED"] = 20] = "NOT_AUTHORIZED";
ErrorCode2[ErrorCode2["INVALID_RESPONSE"] = 100] = "INVALID_RESPONSE";
ErrorCode2[ErrorCode2["OPERATION_FAILED"] = 101] = "OPERATION_FAILED";
ErrorCode2[ErrorCode2["SERVER_ERROR"] = 102] = "SERVER_ERROR";
ErrorCode2[ErrorCode2["RESOURCE_NOT_FOUND"] = 104] = "RESOURCE_NOT_FOUND";
ErrorCode2[ErrorCode2["OPERATION_IN_PROCESS"] = 107] = "OPERATION_IN_PROCESS";
return ErrorCode2;
})(ErrorCode || {});
var errorCode_default = ErrorCode;
// lib/core/http/apResponseHandler.ts
var _ApResponseHandler_static, getJsonData_fn, getTextData_fn;
var _ApResponseHandler = class _ApResponseHandler {
static handle(response) {
return __async(this, null, function* () {
var _a, _b;
if (response.status >= 400 || response.status < 200) {
throw new Error(
`http error (${response.status}) not a successfull response. ${yield __privateMethod(_a = _ApResponseHandler, _ApResponseHandler_static, getTextData_fn).call(_a, response)}`
);
}
var jsonResponse = yield __privateMethod(_b = _ApResponseHandler, _ApResponseHandler_static, getJsonData_fn).call(_b, response);
if (!jsonResponse) {
throw new NotbankError("http error. (status=" + response.status + ")", -1);
}
var standardResponse = jsonResponse;
if ((standardResponse == null ? void 0 : standardResponse.result) === false && (standardResponse == null ? void 0 : standardResponse.errorcode) != null && !(standardResponse.errorcode == errorCode_default.OPERATION_IN_PROCESS && standardResponse.errormsg === "Operation In Process")) {
throw NotbankError.Factory.createFromApResponse(standardResponse);
}
return jsonResponse;
});
}
};
_ApResponseHandler_static = new WeakSet();
getJsonData_fn = function(response) {
return __async(this, null, function* () {
try {
return yield response.json();
} catch (err) {
return null;
}
});
};
getTextData_fn = function(response) {
return __async(this, null, function* () {
try {
return yield response.text();
} catch (err) {
return null;
}
});
};
__privateAdd(_ApResponseHandler, _ApResponseHandler_static);
var ApResponseHandler = _ApResponseHandler;
// lib/core/http/nbResponseHandler.ts
var _NbResponseHandler_static, getData_fn;
var _NbResponseHandler = class _NbResponseHandler {
static handle(response, paged) {
return __async(this, null, function* () {
var _a;
try {
var jsonResponse = yield __privateMethod(_a = _NbResponseHandler, _NbResponseHandler_static, getData_fn).call(_a, response);
if (!jsonResponse) {
throw new NotbankError("http error. (status=" + response.status + ")", -1);
}
var nbResponse = jsonResponse;
if ((nbResponse == null ? void 0 : nbResponse.status) === "success") {
return paged ? jsonResponse : nbResponse.data;
}
const error = NotbankError.Factory.createFromNbResponse(nbResponse);
throw error;
} catch (error) {
throw error;
}
});
}
};
_NbResponseHandler_static = new WeakSet();
getData_fn = function(response) {
return __async(this, null, function* () {
try {
const data = yield response.json();
return data;
} catch (err) {
return null;
}
});
};
__privateAdd(_NbResponseHandler, _NbResponseHandler_static);
var NbResponseHandler = _NbResponseHandler;
// lib/core/http/requester.ts
var import_node_fetch = __toESM(require_browser(), 1);
var _aptoken;
var Requester = class {
constructor() {
__privateAdd(this, _aptoken);
__privateSet(this, _aptoken, null);
}
updateSessionToken(aptoken) {
__privateSet(this, _aptoken, aptoken);
}
request(config) {
const isPostOrDeleteRequest = [
"POST" /* POST */,
"DELETE" /* DELETE */
].includes(config.requestType);
var url = isPostOrDeleteRequest ? config.url : this.getUrlWithSearchParams(config.url, config.params);
var body = isPostOrDeleteRequest ? config.params : null;
var requestData = {
method: config.requestType,
headers: this.getHeaders(config.extraHeaders)
};
if (body) {
requestData.body = JSON.stringify(body);
}
return (0, import_node_fetch.default)(url, requestData);
}
getHeaders(extraHeaders) {
var headers = {
"Content-type": "application/json",
charset: "UTF-8"
};
if (__privateGet(this, _aptoken)) {
headers["aptoken"] = __privateGet(this, _aptoken);
}
if (extraHeaders) {
return __spreadValues(__spreadValues({}, headers), extraHeaders);
}
return headers;
}
getUrlWithSearchParams(endpoint, params) {
return params ? endpoint + "?" + new URLSearchParams(params) : endpoint;
}
};
_aptoken = new WeakMap();
// lib/core/http/httpClient.ts
var _requester, _host;
var HttpConnection = class {
constructor(domain) {
__privateAdd(this, _requester);
__privateAdd(this, _host);
__privateSet(this, _requester, new Requester());
__privateSet(this, _host, "https://" + domain);
}
nbRequest(endpoint, requestType, params, paged = false) {
return __async(this, null, function* () {
const url = this.getNbUrl(endpoint);
var response = yield __privateGet(this, _requester).request({ url, requestType, params });
return yield NbResponseHandler.handle(response, paged);
});
}
apRequest(endpoint, requestType, params, extraHeaders) {
return __async(this, null, function* () {
const url = this.getApUrl(endpoint);
var response = yield __privateGet(this, _requester).request({
url,
requestType,
params,
extraHeaders
});
return yield ApResponseHandler.handle(response);
});
}
updateSessionToken(sessionToken) {
__privateGet(this, _requester).updateSessionToken(sessionToken);
}
authenticateUser(params) {
return __async(this, null, function* () {
var response = yield this.apRequest(
"AuthenticateUser" /* AUTHENTICATE_USER */,
"GET" /* GET */,
null,
params
);
__privateGet(this, _requester).updateSessionToken(response.SessionToken);
});
}
subscribe(endpoint, firstIdentifier, secondIdentifier, message, subscriptionCallbacks) {
throw new Error("Method not implemented.");
}
unsubscribe(endpoint, firstIdentifier, secondIdentifier, message, callback_ids) {
throw new Error("Method not implemented.");
}
setResponseHandler(responseHandler) {
throw new Error("Method not implemented.");
}
setResponseHandlers(responseHandlers) {
throw new Error("Method not implemented.");
}
getApUrl(endpoint) {
return __privateGet(this, _host) + "/ap/" + endpoint;
}
getNbUrl(endpoint) {
return __privateGet(this, _host) + "/api/nb/" + endpoint;
}
connect() {
return Promise.resolve();
}
close() {
return Promise.resolve();
}
};
_requester = new WeakMap();
_host = new WeakMap();
// lib/utils/completeParams.ts
function completeParams(params, omsId) {
return __spreadProps(__spreadValues({}, params), {
OMSId: omsId
});
}
// lib/services/accountService.ts
var AccountService = class {
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(
"GetAccountTransactions" /* GET_ACCOUNT_TRANSACTIONS */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getaccountpositions
*/
getAccountPositions(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetAccountPositions" /* GET_ACCOUNT_POSITIONS */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getaccountinstrumentstatistics
*/
getAccountInstrumentStatistics(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetAccountInstrumentStatistics" /* GET_ACCOUNT_INSTRUMENT_STATISTICS */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getaccountinfo
*/
getAccountInfo(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetAccountInfo" /* GET_ACCOUNT_INFO */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
};
// lib/services/authService.ts
var AuthService = class {
constructor(connection) {
this.connection = connection;
}
/**
* https://apidoc.notbank.exchange/?http#webauthenticateuser
*/
webAuthenticateUser(params) {
return __async(this, null, function* () {
return yield this.connection.apRequest(
"WebAuthenticateUser" /* WEB_AUTHENTICATE_USER */,
"NONE" /* NONE */,
params
);
});
}
/**
* https://apidoc.notbank.exchange/?http#logout
*/
logOut() {
return __async(this, null, function* () {
return yield this.connection.apRequest("LogOut" /* LOGOUT */, "POST" /* POST */);
});
}
};
// lib/services/feeService.ts
var FeeService = class {
constructor(connection) {
this.OMS_ID = 1;
this.connection = connection;
}
/**
* https://apidoc.notbank.exchange/#getdepositfee
*/
getDepositFee(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetDepositFee" /* GET_DEPOSIT_FEE */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getwithdrawfee
*/
getWithdrawFee(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetWithdrawFee" /* GET_WITHDRAW_FEE */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getomswithdrawfees
*/
getOMSWithdrawFees(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetOMSWithdrawFees" /* GET_OMS_WITHDRAW_FEES */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getomsdepositfees
*/
getOMSDepositFees(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetOMSDepositFees" /* GET_OMS_DEPOSIT_FEES */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
/**
* https://apidoc.notbank.exchange/#getaccountfees
*/
getAccountFees(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetAccountFees" /* GET_ACCOUNT_FEES */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
/**
* https://apidoc.notbank.exchange/#getorderfee
*/
getOrderFee(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetOrderFee" /* GET_ORDER_FEE */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
};
// lib/services/instrumentService.ts
var InstrumentService = class {
constructor(connection) {
this.OMS_ID = 1;
this.connection = connection;
this.instrumentCache = {};
}
/**
* https://apidoc.notbank.exchange/#getinstruments
*/
getInstruments(params = {}) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetInstruments" /* GET_INSTRUMENTS */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getinstrument
*/
getInstrument(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetInstrument" /* GET_INSTRUMENT */,
"POST" /* POST */,
paramsWithOMSId
);
}
getInstrumentBySymbol(params) {
return __async(this, null, function* () {
if (!(params.symbol in this.instrumentCache)) {
var instruments = yield this.getInstruments();
instruments.map((instrument) => this.instrumentCache[instrument.Symbol] = instrument);
}
if (params.symbol in this.instrumentCache) {
return Promise.resolve(this.instrumentCache[params.symbol]);
} else {
throw new NotbankError("no instrument found for symbol " + params.symbol, -1);
}
});
}
/**
* https://apidoc.notbank.exchange/#getinstrumentverificationlevelconfig
*/
getInstrumentVerificationLevelConfigs(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetInstrumentVerificationLevelConfig" /* GET_INSTRUMENT_VERIFICATION_LEVEL_CONFIG */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
};
// lib/services/productService.ts
var ProductService = class {
constructor(connection) {
this.OMS_ID = 1;
this.connection = connection;
this.productCache = {};
}
/**
* https://apidoc.notbank.exchange/#getproduct
*/
getProduct(params) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetProduct" /* GET_PRODUCT */,
"POST" /* POST */,
paramsWithOMSId
);
}
/**
* https://apidoc.notbank.exchange/#getproducts
*/
getProducts() {
return __async(this, arguments, function* (params = {}) {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return this.connection.apRequest(
"GetProducts" /* GET_PRODUCTS */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
getProductBySymbol(params) {
return __async(this, null, function* () {
if (!(params.symbol in this.productCache)) {
var products = yield this.getProducts();
products.map((product) => this.productCache[product.Product] = product);
}
if (params.symbol in this.productCache) {
return Promise.resolve(this.productCache[params.symbol]);
} else {
throw new NotbankError("no product found for symbol " + params.symbol, -1);
}
});
}
/**
* https://apidoc.notbank.exchange/#getverificationlevelconfig
*/
getVerificationLevelConfig(params) {
return __async(this, null, function* () {
const paramsWithOMSId = completeParams(params, this.OMS_ID);
return yield this.connection.apRequest(
"GetVerificationLevelConfig" /* GET_VERIFICATION_LEVEL_CONFIG */,
"POST" /* POST */,
paramsWithOMSId
);
});
}
};
// lib/services/reportService.ts
var ReportService = class {
constructor(connection) {
this.OMS_ID = 1;
this.connection = connection;
}
/**
* https://apidoc.notbank.exchange/#generatetradeactivityreport
*/
generateTradeActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"GenerateTradeActivityReport" /* GENERATE_TRADE_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#generatetransactionactivityreport
*/
generateTransactionActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"GenerateTransactionActivityReport" /* GENERATE_TRANSACTION_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#generateproductdeltaactivityreport
*/
generateProductDeltaActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"GenerateProductDeltaActivityReport" /* GENERATE_PRODUCT_DELTA_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#generatepnlactivityreport
*/
generatePnLActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"GeneratePnLActivityReport" /* GENERATE_PNL_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#scheduletradeactivityreport
*/
scheduleTradeActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"ScheduleTradeActivityReport" /* SCHEDULE_TRADE_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#scheduletransactionactivityreport
*/
scheduleTransactionActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"ScheduleTransactionActivityReport" /* SCHEDULE_TRANSACTION_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#scheduleproductdeltaactivityreport
*/
scheduleProductDeltaActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"ScheduleProductDeltaActivityReport" /* SCHEDULE_PRODUCT_DELTA_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#scheduleprofitandlossactivityreport
*/
scheduleProfitAndLossActivityReport(request) {
const params = completeParams(request, this.OMS_ID);
return this.connection.apRequest(
"ScheduleProfitAndLossActivityReport" /* SCHEDULE_PROFIT_AND_LOSS_ACTIVITY_REPORT */,
"POST" /* POST */,
params
);
}
/**
* https://apidoc.notbank.exchange/#canceluserreport
*/
cancelUserReport(request) {
return this.connection.apRequest(
"CancelUs